Add this code to the end of your child themes functions.php file to exclude one of more product categories from displaying in the WooCoomerce Product Category widget.
The above code removes 2 categories.
Simply change the category i.d’s to suit your own needs.
Wendy says
Hi Brad
Found this through your answer on stackoverflow. Thanks for providing the snippet however I cannot get it to work. My category stays in the “woocommerce product categories widget”. I of course changed the category id. Could it be a change in Woo 2.2? I looked at the class-wc-widget-product-categories.php but couldn’t see any change. This file however is not in the new Woo 2.2 widget-product_categories.php
Appreciate any help you can provide.
Thanks
Wendy
Fernando says
Is possible to affect two sidebars? For example in sidebar 1 I have the widget and want to exclude 3 of 10 categories in sidebar 2 I have the same widget but I want to exclude only 1 category.
Brad Dalton says
You can modify the code to do that.
Fernando says
Do you have any example for that?
Brad Dalton says
The code would need to be written and tested.
Jason says
Is there a way to do this for woocommerce shortcode? ie
Admin (1)
Genesis (17)
WooCommerce (111)
WordPress (5)
Brad Dalton says
You could add a argument to the code to do this.