Home Forums WoodMart support forum Hide add to cart button for products in a specified category

Hide add to cart button for products in a specified category

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #455688

    dweb360
    Participant

    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

    #455843

    Artem Temos
    Keymaster

    Hello,

    Try to use our Theme Settings Presets and enable the “Catalog mode” option for specific conditions. Read more about our presets functionality in the documentation here https://xtemos.com/docs-topic/theme-settings-presets/

    Kind Regards

Viewing 2 posts - 1 through 2 (of 2 total)