New Landing How can we help? Atelier Hide some of the product tags in sidebar

Viewing 15 posts - 1 through 15 (of 22 total)
  • Posted in: Atelier
  • #290318
    AgenceSurprise
    Member
    Post count: 76

    Hi,
    I have product tags in my woocommerce sidebar, and I would like to hide some of them, but not all of them.
    Would you have a solution ?

    Thanks in advance !
    Léa

    #290322
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please specify the tags. I will provide you exact solution.
    Thanks
    Mohammad

    #290323
    AgenceSurprise
    Member
    Post count: 76
    This reply has been marked as private.
    #290350
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Just paste this code at functions.php of child theme.

    add_filter( 'woocommerce_product_categories_widget_args', 'woo_product_cat_widget_args' );
    
    function woo_product_cat_widget_args( $cat_args ) {
    	
    	$cat_args['exclude'] = array('16'); //just insert the comma separated category ids.
    	
    	return $cat_args;
    }

    Thanks
    Mohammad

    #290359
    AgenceSurprise
    Member
    Post count: 76

    Ok thanks I’ll try that !
    Where can I find the product tag id ? (I see that you talk about category, but I’m talking about product tag, don’t know if the code is the good one then ?)

    Thanks

    #290360
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please go to Admin > Products > Categories > Edit any category, you will get the id at url.
    Thanks
    Mohammad

    #290362
    AgenceSurprise
    Member
    Post count: 76

    I’m not talking about product categories but product tags.
    I’ve found the product tag ID but is your code still working since I’m not trying to remove some categories but some tags ?

    #290391
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please try to use this code:-

    function custom_woocommerce_tag_cloud_widget() {
       $cat_args['exclude'] = array('16'); //just insert the comma separated category ids.
    	
    	return $cat_args;
        
    }
    add_filter( 'woocommerce_product_tag_cloud_widget_args', 'custom_woocommerce_tag_cloud_widget' );

    Thanks
    Mohammad

    #290808
    AgenceSurprise
    Member
    Post count: 76

    Hi Mohammad,
    Thanks a lot for your help, but I’ve just tried to insert the code you gave me in the function.php file of my child theme (with the tags ids), it doesn’t seems to work…

    #290868
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    My code worked fine. I removed the Geek Tag from the woocommerce sidebar Tag widget.
    Thanks 🙂
    Mohammad

    #290900
    AgenceSurprise
    Member
    Post count: 76

    Hi Mohammad,

    I’m sorry but I’ve trying again, I saw the geek tag id you addedd, I remove it to add the ones I wanted, and the tags still appear in the sidebar. I’ve attached you a screenshot where you can see in the sidebar the “animaux” and “déco” tag, which I would like to remove and who’s ids are in the function.php file.
    Thanks for your help 🙂

    Attachments:
    You must be logged in to view attached files.
    #290903
    David Martin – Support
    Moderator
    Post count: 20834

    Please paste your code so we can see what you have tried to work with.

    #290905
    AgenceSurprise
    Member
    Post count: 76

    Yes of course :

    function custom_woocommerce_tag_cloud_widget($cat_args) {
    $cat_args[‘exclude’] = array(‘670, 677, 676, 667, 671, 675, 673, 678’); //just insert the comma separated category ids.

    return $cat_args;

    }
    add_filter( ‘woocommerce_product_tag_cloud_widget_args’, ‘custom_woocommerce_tag_cloud_widget’ );

    #290917
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    I dont see the widget tag at my side like your screenshot.
    Thanks
    Mohammad

    #290919
    AgenceSurprise
    Member
    Post count: 76

    Yes it’s normal, I’ve removed it until I can fix this problem and show only the tags I want…
    I don’t want my clients to see all the tags.

    The screenshot was taken this morning before I removed it

Viewing 15 posts - 1 through 15 (of 22 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register