Hello
I tried to add the following functions in functions.php file but it doesn’t work to remove the add to cart button and buy now button.
Can you tell me the ‘hook’ to use with your theme?
Thank you so much
add_action( 'woocommerce_after_shop_loop_item', 'remove_add_to_cart_for_armchairs_category', 1 );
function remove_add_to_cart_for_armchairs_category() {
global $product;
if ( has_term( 'armchairs', 'product_cat', $product->get_id() ) ) {
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart');
}
}
Attachments:
You must be
logged in to view attached files.