Only show subcategories and products of current category?
-
In the WooCommerce settings, if you uncheck “When showing subcategories, hide products” it shows all products underneath that category, even under any of the current sub-level categories.
I need a variant of that—is there a way to only show products of the *current category* but not any of the subcategories?
For example, if I’m currently browsing Subcategory A, right now it shows:
Main Category
* Subcategory A
* * Subcategory B
* * Subcategory C
* Products of Subcategory A
* Products of Subcategory B
* Products of Subcategory CWe’d like it to show:
Main Category
* Subcategory A
* * Subcategory B
* * Subcategory C
* Products of Subcategory AEspecially when you’re on Main Category, it shows all products underneath that category as well as any subcategories. I just need subcategories.
I don’t have any products underneath the Main Category so it shouldn’t display any products.
I made a copy of archive-product.php and woocommerce_product_subcategories() so I could experiment but at a loss as to what to change the wp_query to only query products in the current category (but not any of the children).
Thanks,
Dave
- The topic ‘Only show subcategories and products of current category?’ is closed to new replies.