menardmam
menardmam

Reputation: 9986

WooCommerce_Widget_Product_Categories widget remove category

I used the WooCommerce Product Categories widget but i need to "remove" from the list created some category, i add the option in the widget, but have no idea where to put it in the code... can somebody help ?

Upvotes: 0

Views: 2392

Answers (1)

avraham
avraham

Reputation: 56

I was trying to do this yesterday. Here is my solution.

On your functions.php add this:

function exclude_widget_categories($args){
    $exclude = "25"; // The IDs of the excluding categories separated by commas.
    $args["exclude"] = $exclude;
    return $args;
}


add_filter("woocommerce_product_categories_widget_args","exclude_widget_categories");

I adapted this snippet I found here: Exclude category from widget category list to work with the woocommerce filter.

Upvotes: 2

Related Questions