Hello
I want to hide “Add to cart” button only for “Gaine sur mesure” category. Can you help me ?
Whe I try via the code below:
function cacher_bouton_panier_categorie() {
$category = 'gaine-sur-mesure'; // Remplacer par le nom de la catégorie à masquer
if ( has_term( $category, 'product_cat' ) ) {
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
}
}
add_action( 'woocommerce_after_shop_loop_item', 'cacher_bouton_panier_categorie' );
add_action( 'woocommerce_single_product_summary', 'cacher_bouton_panier_categorie' );
Also the extra fields are hidden!
Thank you for your help