Hide “add to cart” button on certain products or categories

The Issue:

Donec ullamcorper nulla non metus auctor fringilla. Curabitur blandit tempus porttitor. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.

Where and when you might use this

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Etiam porta sem malesuada magna mollis euismod. Maecenas faucibus mollis interdum. Maecenas faucibus mollis interdum. Vestibulum id ligula porta felis euismod semper. Sed posuere consectetur est at lobortis. Curabitur blandit tempus porttitor. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Maecenas sed diam eget risus varius blandit sit amet non magna. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Nullam id dolor id nibh ultricies vehicula ut id elit.

Option 1:

You can Remove the Add to Cart button on a Certain Category

The Code:

// Woocommerce - Remove Add to Cart button on a Certain Categoryadd_action( 'woocommerce_after_shop_loop_item', 'remove_add_to_cart_buttons', 1 );function remove_add_to_cart_buttons() { // replace a_category and another_category with the slugs of the categories you'd like to have the button removed from if( is_product_category( array( 'a_category', 'another_category'))) { remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' ); } }

OPTION 2:

You can Remove the Add to Cart button on a Certain Product

The Code:

// Woocommerce – Remove Add to Cart button on a Certain Productadd_filter(‘woocommerce_is_purchasable’, ‘wpblog_specific_product’); function wpblog_specific_product($purchaseable_product_wpblog, $product) { return ($product->id == specific_product_id (512) ? false : $purchaseable_product_wpblog); }