I have products in categories and sub categories and am using the "WooCommerce Product Categories" Widget to display the hierarchical list of categories, sub-categories and products in a sidebar.
When I click on the lower most sub-category, the list of products is displayed using a View. However if I click on a sub-category above that level, that is, a sub-category (or top category) that contains other sub-categories, then I get a 404 page.
Main Category
- Sub-Category A
- Sub-Category 01
- Sub-Category B
- Sub-Category 02
- Sub-Category 03
When clicked, sub-cat 01, 02 and 03 will show products, however the main category and sub-cat A and B will give a 404.
Within Toolset I have created an entry for WordPress Archives. In the Loops Section I have selected "Product Categories" in the Taxonomy Archives section. It does say "This archive will include Products only". I imagine that this is part of the problem.
The question is, how can I get the View, which displays the simple table of products, to work when there are products from several sub-categories?
I did read some of the other topics that I felt might be relevant and did quickly and briefly try some of the ideas, however nothing changed. This topic seemed the most promising https://toolset.com/forums/topic/woocommerce-category-archive-doesnt-work-with-both-products-and-sub-categories/. However as it wasn't quite what I was looking for I found it difficult to extract the information that would work for my situation.
As the links with in the Widget seem to be formatted in a way that makes sense, I imagine that the problem must be related to getting Views to combine products from multiple categories.
Your help would be very much appreciated.
Hi Nic,
It should be possible to display product category archives regardless of the hierarchy. The results displayed should reflect products within a category, or within any of its subcategories. For instance:
Main Category
- Product: Membership
- Sub Cat A
---Sub Cat 01
------Product: Product One
In this case, the /product-category/main-category archive should display both Membership and Product One. The /product-category/sub-cat-a archive should show Product One, as well as the /product-category/sub-cat-a/sub-cat-01 archive.
Have I understood the need correctly?
Try to trigger an update for your permalinks by going to wp-admin/options-permalink.php and clicking Save Changes, then see if your URLs behave better. If this does not work, please let me know your Product Category permalink settings: Settings > Permalinks > Product Permalinks.
Thanks Christian. I have been able to find a way of displaying the categories without using Toolset. This is working at the moment, however I'll come back to you if I need to explore this route again.