Skip to content

Instantly share code, notes, and snippets.

@goliver79
Created April 19, 2014 17:38
Show Gist options
  • Select an option

  • Save goliver79/11091523 to your computer and use it in GitHub Desktop.

Select an option

Save goliver79/11091523 to your computer and use it in GitHub Desktop.
[WOOCOMMERCE] Hide empty categories in Woocommerce Widget Product Categories
<?php
/*
* @goliver79
* woocommerce hide empty categories in woocommerce widget "product categories"
*/
function woo_hide_product_categories_widget( $list_args ){
$list_args[ 'hide_empty' ] = 1;
return $list_args;
}
add_filter( 'woocommerce_product_categories_widget_args', 'woo_hide_product_categories_widget' );
@BillKarkavos
Copy link
Copy Markdown

thanks - also needed this.

@marcilioqsj
Copy link
Copy Markdown

Hi guys, i'm new here and I need to apply this solution to my woocommerce but I don't know how to do it. Do I have to edit this file or create it? Where is located? Thanks :)

@Dampas
Copy link
Copy Markdown

Dampas commented Nov 21, 2015

This is great.
Can you do the same with the main menu?
I need filter which move out empty menu categories.

@tbahsan
Copy link
Copy Markdown

tbahsan commented Oct 12, 2020

Not working for me, Anyone can suggest me something?

@harryac07
Copy link
Copy Markdown

Same here. Not working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment