Home Forums WoodMart support forum Hide cart for certain products categories

Hide cart for certain products categories

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

    jaak69
    Participant

    Hello,
    I’m tring to suse the next script:

    function western_custom_buy_buttons(){
    
        $product = get_product();
     
        if ( has_term( array('Piimatooted','Lihatooted','Sügavkülmatooted'), 'product_cat') ){ 
        // removing the purchase buttons 
        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 ); 
        remove_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 ); 
        remove_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30 ); 
        remove_action( 'woocommerce_variable_add_to_cart', 'woocommerce_variable_add_to_cart', 30 ); 
        remove_action( 'woocommerce_external_add_to_cart', 'woocommerce_external_add_to_cart', 30 ); 
        } 
     } 
     add_action( 'wp', 'western_custom_buy_buttons' );

    This works for single product page but not for category page. How to remove cart from category page?

    #546137

    Luke Nielsen
    Keymaster

    Hello,

    With the help of our presets and through the “Catalog mode” option, you can hide the add to cart button for specific categories. https://take.ms/0PzhE

    Here is an article on how to use theme presets: https://xtemos.com/docs-topic/theme-settings-presets/

    Kind Regards

Tagged: 

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