This topic has 7 replies, 3 voices, and was last updated 8 years by Radu.

  • Author
  • #138529
     iza
    Participant

    Hello seventhqueen,

     

    Can you pls assist me what i am missing.

    I want to remove add to cart button on quick view in specific category and this code still doesnt work.

     

     

    function remove_add_to_cart(){

    $product = get_product();

    if( has_term( ‘my-category’, ‘product_cat’ ) ){

    remove_action(‘woocommerce_single_product_modal_summary’, ‘woocommerce_template_single_add_to_cart’, 30 ); } }

    add_action(‘wp’,’remove_add_to_cart’);

     

     

     

    If i use @sharmstr code

     

    add_action( ‘init’, ‘remove_product_meta’ );

    function remove_product_meta() {

    remove_action(‘woocommerce_single_product_modal_summary’, ‘woocommerce_template_single_add_to_cart’, 30 );

    }

     

    Its work but it removes globally.

     

    Thanks in advance

    #138564
     Laura
    Moderator

    Hello, will assign the ticket to a higher support level who can help and advise you in your query.
    Thanks! ?

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #138623
     Radu
    Moderator

    Hi,

    Try to use this code

    COPY CODE
    
    add_action( ‘init’, ‘remove_product_meta’ );
    
    function remove_product_meta() {
    	if ( has_term( 'audio', 'product_cat' ) ) {
    
    		remove_action('woocommerce_single_product_modal_summary', 'woocommerce_template_single_add_to_cart', 30 );
    
    	}
    }
    

    Instead of audio there should be category name.

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #139217
     iza
    Participant

    Hi,

    code still doesnt work. any other thoughts?

    #139293
     Radu
    Moderator

    Try with this instead

    add_action( ‘init’, ‘remove_product_meta’ );

    function remove_product_meta() {
    if ( is_product_category(‘my-category’) ) {

    remove_action(‘woocommerce_single_product_modal_summary’, ‘woocommerce_template_single_add_to_cart’, 30 );

    }
    }

    Replace my-category with your slug

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #141022
     iza
    Participant

    Hi radu,

    Sorry for a late reply,

    The code still doesnt work. Any other ideas why?

    Thanks in advanced!

    #141023
     iza
    Participant
    This reply has been set as private.
    #141189
     Radu
    Moderator

    Do you have replaced my-category with your category slug ? from the snippet ?

    For those kinds of questions please write us to themesupport@seventhqueen.com

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 8 posts - 1 through 8 (of 8 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?