I want to display an additional button below the description to a specific product category: "bracelets" so I developed a piece of code, which does not work:
add_action( 'woocommerce_single_product_summary', 'my_extra_button_on_product_page', 30 );
function my_extra_button_on_product_page() {
if ( is_product_category('bracelets')) {
global $product;
echo '<a href="www.test.com">Extra Button</a>';
}
}
Any idea about what's wrong here?
the following code adds the button before the loop on a product category archive
Your question is not really clear.
1) If you want to display a custom button for a specific product category on product category archives pages below the description of this product category you will use:
2) If you want to display a custom button in single product pages for a specific product category below the short description of this product you will use:
3) If you want to display a custom button in single product pages for a specific product category below the description (in the product tab) of this product you will use:
4) If you want to display a custom button in single product pages for a specific product category below the product tabs, you will use:
Code goes in function.php file of your active child theme (or active theme).
Tested and works.