Top-Level categories don’t show empty subcategories
-
After updating Woocommerce to version 3.3.3, when I display a top-level category that has no products but has subcategories without any product, the subcategories are no longer displayed in the archive page.
This happens only for the top-level categories but not in the sub-categories under the same conditions.
If inside subcategories exist one or more products the others empty categories will be shown. Actually I fix the problem by avoiding the use ofhave_posts()
in archive-product.php and substitute it with:$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); // get current term $children = get_term_children($term->term_id, get_query_var('taxonomy')); // get children if ( have_posts() || sizeof($children)>0) { ... ... ...
In my file functions.php I have this filter:
add_filter( 'woocommerce_product_subcategories_hide_empty', '__return_false');
Everything worked normally with version 3.3.2.
Can you help me?
- The topic ‘Top-Level categories don’t show empty subcategories’ is closed to new replies.