Remove "add to cart" button

I’m trying to remove the add to cart button from a specific category of products both in the archive page and on the products themselves.

My understanding was that to accomplish this you can add code similar to this to the functions.php page of the child theme.

function remove_add_to_cart_buttons() {
if( is_product_category(‘cars’) ) {
remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’ );
}
}
add_action( ‘woocommerce_after_shop_loop_item’, ‘remove_add_to_cart_buttons’, 1 );

It’s not working. Any help would be great!

Hello @swanhaven,

Thanks for asking. :slight_smile:

You can take a look at following tutorial and thread to remove Add to Cart button from specific category:

https://www.themelocation.com/how-to-remove-add-to-cart-button-from-a-certain-category-woocommerce/
https://stackoverflow.com/questions/47614054/remove-add-to-cart-button-for-specific-product-categories-in-woocommerce-3

Before making any changes I suggest you to install and activate Child theme. I am sharing the relevant resources that you can use to download and setup child theme:

  1. Download Child theme from here: https://theme.co/apex/child-themes
  2. Refer following tutorials to setup child theme:

Thanks.

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