Skip to content

Instantly share code, notes, and snippets.

@rwkyyy
Created November 7, 2018 13:51
Show Gist options
  • Save rwkyyy/869d300080ab989c72aadfd4db362591 to your computer and use it in GitHub Desktop.
Save rwkyyy/869d300080ab989c72aadfd4db362591 to your computer and use it in GitHub Desktop.
add a button on product page description
add_action( 'woocommerce_single_product_summary', 'add_after_description_rwk', 25 );
function add_after_description_rwk() {
?>
<div class="button">HIT ME</div>
<?php }
@abdullapk
Copy link

How can i add button next to cart ?
When i click on it, it goes to another page..
Example a button with link ( different products have different links)

@rwkyyy
Copy link
Author

rwkyyy commented Nov 18, 2019

Hi @abdullapk,
The <div class="button">HIT ME</div> is for example purposes, can be changed with anything.
To add it next to the add to cart, nearest you can do is to use woocommerce_before_add_to_cart_button instead of woocommerce_single_product_summary , you will still have to use some CSS to make it display inline.

@abdullapk
Copy link

abdullapk commented Nov 18, 2019 via email

@abdullapk
Copy link

https://www.spanningglobal.com/product/air-jordan-shoes/

Please have a look on the website.
On the description i need to add a link.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment