my woocommerce website has the following structure:
- / = Homepage (Static Page)
- /products/ = Shop Page
- /products/ = Category Base
- /products/%product_cat% = Product Perma (custom base)
a url for a product becomes: website.com/products/parent/child/product-permalink
Currently the Shop Page abd Product Permalink works, along with the Parent Cat, but the child returns a 404.
Initially I had used this code in my functions.php
add_filter( 'rewrite_rules_array', function( $rules )
{
$new_rules = array(
'products/([^/]*?)/page/([0-9]{1,})/?$' => 'index.php?product_cat=$matches[1]&paged=$matches[2]',
'products/([^/]*?)/?$' => 'index.php?product_cat=$matches[1]',
);
return $new_rules + $rules;
} );
Easy. Today I introduced Parent and Child categories. Snap!
I found the following post on SO: Woocommerce rewrite rule for product sub category
However, this doesn't do the trick, my configuration differs as I also have that Shop Page using the /Products location.
Can anyone see a quick fix?
Thank so much.