Description
Tested on WordPress 6.6.1 and Woocommerce 7.1.0
This is a simple plugin that fixes 404 error when product category base is set the same as shop base in WooCommerce. Now you can set up WooCommerce permalinks to get something like:
example.com/shop/
=> Shop page listing productsexample.com/shop/category-name/
=> Category page listing products from a category (generates 404 error without this plugin)example.com/shop/category-name/product-name/
=> Product page showing product details
Supports child categories up to 2nd level deep: example.com/shop/my-cat-1/sub-cat1/sub-sub-cat/product-name/
Supports Shop child pages: example.com/shop/my-account/
The plugin does not work on multisite network.
== Intro ==
If you are trying to use the same base “shop” for categories & products, unfortunately you will get an error on the category pages. Here’s the Woocommerce official explanation:
Please note: The product custom base should not conflict with the taxonomy permalink bases. If you set the product base to ‘shop’ for example, you should not set the product category base to ‘shop’ too as this will not be unique and will conflict. WordPress requires something unique so it can distinguish categories from products.
It’s not recommended to use same base for products and taxonomies, but if you have to make it this way…this plugin will resolve this issue.
== Installation ==
1. Upload the plugin files to the `/wp-content/plugins/plugin-name` directory, or install the plugin through the WordPress plugins screen directly.
2. Activate the plugin through the ‘Plugins’ screen in WordPress
No configuration is required. Works out of the box.
Find Out More
Documentation & Screenshots
Roal Alleman –
Works like charm! Thank so much for resolving my big problem. Regards!
Anton –
You saved my day, many thanks.
Mike L. –
Great plugin….thank you.
msass –
Installed, enabled….it works, nothing more to do.
Good job.
thanks –
Easy to use and worked flawlessly right out of the box.
Well done, thanks.
smmbco –
Works 🙂
Alvaro Sanchez –
Hi, do you know if works for tag base too? thx
admin (verified owner) –
Hi, please send me a screenshot of your WP permalinks settings. Will try it on our dev, if not working you will receive an update soon…
SBC –
Thanks!
Lnc –
Finally a solution that works! Thanks!
a-samoylov (verified owner) –
Thanx!!!!! a lot
BigM –
Wow…solution I was looking for
panp2 (verified owner) –
Works where other solutions failed! Spotted a bug where opt_rule[‘sub-cats’] is not set, WP will throw an undefined index error. Resolved by changing if ( $seco ) to if ( isset( $opt_rule[‘sub-cats’] )) and then moving the $seco = $opt_rule[‘sub-cats’] ; rule into the if statement. Hope that helps anyone spotting the same
admin (verified owner) –
Version 2.2 resolved this issue.
nick.seoshnik (verified owner) –
Thanks. It’s working!
fetmaster2013 (verified owner) –
Great work! Thx a lot! When will support more child categories?
aljandro –
Thank you!… now waiting support on PHP 7.3 🙂
gavn8r (verified owner) –
Works like a charm! Thank you so much for this excellent plugin. I’ve been fighting this problem for years now.
igor.v.sabadash (verified owner) –
It’s working very well!!! Super!!!
philsy (verified owner) –
F$#king Genius! Thank you!
Mark Baldwin (verified owner) –
Wow. Installed plugin. Ensured permalink settings were set (custom shop base and product base were set to /shop). Done. Desired product url structure in place. effortless. thank you!