Remove Button Woocommerce product archive

Hi Support,

I would like to remove the green button that appears when hovering on a product on the product category.

You can see this here: https://woningstyle.nl/product-categorie/keuken/magnetrons/

I know I can just simply add the display none CSS, but then the button (and the cloaked links to the affiliate partner) are still in the source code (which I don’t want). So therefore I would like to remove the button entirely.

An other solution would be to change the button link to the underlying product page URL, instead of the cloaked link to the affiliate partner. If this is possible, that would work as well for me.

Can you help me with ether of the 2 options?

Thanks,

Robin

Hi Robin,

To remove the button, you can add the code below in your child theme’s functions.php file (wp-content/themes/x-child/functions.php)

add_filter( 'woocommerce_is_purchasable', '__return_false');

For more information kindly refer to the link below

Hope this helps.

Hi Support,

I’ve added the suggested line of code in my Child functions.php but it did not do anything?

Hi There,

Thanks for writing in!

Can you please refer to this article and let us know if that works.
https://www.insertcart.com/remove-add-to-cart-button-in-woocommerce-archive-pages-single-product-category/

Thanks

Hi Support,

Unfortunately, none of the codes worked.

Not sure if it is relevant for the solution but the product type I use in Woocommerce is: External/Affiliate product.

Hi @robinweber1989,

Since it’s external then it would required different codes, it’s also discussed here https://stackoverflow.com/questions/43946264/override-external-product-url-to-add-to-cart-product-button. As you can see, it’s handled differently compared to standard products.

I recommend contacting a developer for you wish to remove it through PHP codes, or just add this CSS to your global custom CSS.

.button.product_type_external {
display: none !important;
}

Thanks!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.