Hide the add to cart button for most products – Woocommerce

I’m trying to hide the “add to cart” button for all products except for one or two items on my woocommerce website.

Here is a simple solution I found that sets the products to “purchasable = false”. After placing in the function.php file all the “add to cart” buttons disappear.

/** hides add to cart button**/

add_filter( 'woocommerce_is_purchasable', false );

How do I add exception to this?

I would like to show the add to cart button for product ids 22 & 23

I have spent a few hours researching any help would be greatly appreciated.

Read more here: Hide the add to cart button for most products – Woocommerce

Leave a Reply

Your email address will not be published. Required fields are marked *