Woocommerce | I want to the button 'Add to Cart' on the (all) product-page changed by just 'open product' button.

I know people can click on the image or on the title but I also want a need button (instead of add to cart) to open the product.

Can you guys help me out?

1 Answer 1


Try this

function wc_shop_open_product() {
    echo '<a class="button demo_button" href="'.get_the_permalink().'">Open product</a>';
add_action( 'woocommerce_after_add_to_cart_button', 'wc_shop_open_product' );
  • Where do I need to put this? I put it now on functions.php but it wont work. :(
    – markm
    Jul 21, 2020 at 11:21
  • sorry I placed something wrong copy my code again
    – Pipo
    Jul 22, 2020 at 4:57
  • In functions.php? Cause still nothing changed. I only have the button 'add to cart'.
    – markm
    Jul 22, 2020 at 8:51
  • I see what it's doing. It makes an extra button when I open the product itself. But the button needs to be on the page where all the products are.
    – markm
    Aug 7, 2020 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.