Skip to content

Instantly share code, notes, and snippets.

@goliver79
Created April 19, 2014 17:38
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save goliver79/11091523 to your computer and use it in GitHub Desktop.
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' );
@nicmare
Copy link

nicmare commented Feb 4, 2015

thank you! i need this

@banksmedia
Copy link

Perfect! Great work.

@pmisun
Copy link

pmisun commented Apr 20, 2015

Thank you,

is there any way how to apply this when the type of widget is dropdown menu?

@gaptekupdate
Copy link

Perfecto.. thanks

@BillKarkavos
Copy link

thanks - also needed this.

@marcilioqsj
Copy link

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

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

tbahsan commented Oct 12, 2020

Not working for me, Anyone can suggest me something?

@harryac07
Copy link

Same here. Not working

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