Setup
Desired permalink structure (only these structures exist for products)
Product 1: /shop/category/subcategory/product1/
Product 2: /shop/category/product2/
Woocommerce Product View Settings
View for shopbase: Show categories
View for categories: Show products
Products
Products are only checked for one category OR subcategory
Permalink Settings
Normal settings: /%category%/%postname%/
Base for categories: shop
For products: /shop/%product_cat%/
Archives
Since there are over 100 subcategories, I want to use an archive to list all
the products.
Attempts to solve
With the below attempts I’ve been able to produce a working Product-page
but while doing so, also 404:ing
the subcategory page. I can’t recall which option produces what result.
- I have tried different permalink settings for the product categorybase, including
%category%/%product_cat%
,%category%/%product_cat%/%postname%
,%product_cat%/%product_cat%
,shop/%product_cat%
,shop/%product_cat%/%postname%
, and all those above combinations with an ending as/.
as well - I’ve tried swapping above with the base shop permalink setting.
- I’ve tried chaning Product View Settings to show subcategories instead of products.
- I’ve tried creating pages for the subcategories while having a working Product page, but the subcategory page still returns a
404
. - I’ve tried this SO attempt with no luck.
What am I doing wrong or what part can I rewire to make this work?
So greatful for any hints or leads or answers. Thank you for reading this!