Allow showing of empty categories using 'hide_empty' param of get_categories()
This commit is contained in:
parent
1261e48bcc
commit
4907e1d02d
|
@ -1412,7 +1412,8 @@ if ( ! function_exists( 'woocommerce_product_subcategories' ) ) {
|
|||
'taxonomy' => 'product_cat',
|
||||
'pad_counts' => 1
|
||||
);
|
||||
$product_categories = get_categories( apply_filters( 'woocommerce_product_subcategories_args', $args ) );
|
||||
$args = apply_filters( 'woocommerce_product_subcategories_args', $args );
|
||||
$product_categories = get_categories( $args );
|
||||
|
||||
$product_category_found = false;
|
||||
|
||||
|
@ -1420,7 +1421,9 @@ if ( ! function_exists( 'woocommerce_product_subcategories' ) ) {
|
|||
|
||||
foreach ( $product_categories as $category ) {
|
||||
|
||||
if ( $category->parent != $parent_id || $category->count == 0 )
|
||||
if ( $category->parent != $parent_id )
|
||||
continue;
|
||||
if ( $args['hide_empty'] && $category->count == 0 )
|
||||
continue;
|
||||
|
||||
if ( ! $product_category_found ) {
|
||||
|
|
Loading…
Reference in New Issue