Because I consider this the best ecommerce filter plugin I’ve ever tried, I decided to waste a little time and come up with a solution, without compromising the integrity of the plugin’s author, to hide categories and terms without any associated product.
First, you must add this function to your theme, preferably through the use of a MU-PLUGIN: (or in the theme functions file)
// Oculta categorias vazias no HUSKY - Products Filter for WooCommerce Professional
add_filter( 'husky_get_product_categories_args', 'ocultar_categorias_vazias_husky' );
function ocultar_categorias_vazias_husky( $args ) { $args['hide_empty'] = 1;
$args['hierarchical'] = 1; // Para ocultar as sub-categorias vazias
return $args; }
Then, you should add this little extra CSS:
html input[disabled], .iradio_flat-blue.disabled {
display: none !important;
}
input[disabled] + label, .iradio_flat-blue.disabled + label {
display: none !important;
}
And that’s it, all empty categories and terms should disappear from the search filter ??