I saw loads of posts from people having problems with WooCommerce product pages resulting in a 404 after fiddling with the permalink settings. I was scratching my head on this one for a while as well. Here is how I solved the problem.
Update 2024: I’m now using the excellent WooCommerce Permalink Plugin which not only fixes the 404 error but gives me total control over permalinks. And many useful features to easily change to a pretty URL structure!
I wanted to give products the following permalink structure:
http://www.mydomain.com/shop/product-category/product-name/
But all the product pages were giving the HTTP 404 “Page not found” error.
The problem was, that I had set the “Product category base” as what I wanted the “Shop base” permalink structure to be (“shop“).
In other words. If you go to “WordPress Dashboard -> Permalinks“, and want to set the “Product permalink base” setting to “Shop base” or “Shop base with category“, leave the “Product category base” setting alone.
To make this absolutely clear, according to my observations, to set up a “shop base” permalink structure with WooCommerce, you don’t need to set up anything in the “Optional” permalink settings.
Please note: Check the comments for plenty of useful information..!
Please put a screenshot of your settings. That would be really helpful.
Sure:
Wow, this was really helpful. Thanks a lot for sharing it. I don’t know why the permalink is always 404 of the categories, but now when I changed it in the main setting, everything is fine. Great post, dude. All the best and keep sharing such information, specially for the woocommerce stuff.
This just saved my life man. The only thing I’d recommend is dropping the screenshot in your actual post above so it’s easier to access. I was having this same issue with woo commerce, wmpl and woocommerce multi-lingual, and every time I changed the language, the single product page was broken whether I clicked from the shop page or clicked on it from the dashboard.
This was great! Thanks!
I spent hours on exactly the same problem and there was that “optional” setting staring at me all along. Thanks so much for posting this, you’ve saved me a *very* late night. 🙂
Andrew
Thank you so much!
With this tutorial I fixed my problem in 5 minutes after hours of unsuccessful search!
You saved my day!
Silvia
What about if you want it to say “shop” instead of “category” on product categories? There’s a conflict if you make the product category “shop” like the product permalink base. I have been looking for some code snippet to add into my theme to fix this, but there doesn’t seem to be one. I just want anything in the purchase path to be under .com/shop. :-\
.com/shop — (works)
.com/shop/{product-category} — (doesn’t work)
.com/shop/{product-category}/{product} — (works)
Hi Nathan,
Did you manage to get a solution? I am having the exact same issue presently.
Neha, did you ever find anything here? I’m in the same boat. I feel like it has something to do with similar slugs across categories and products. I had it working, as Nathan describes, and after adding a bunch of products, I get the 404 on .com/shop/{product-category}
I just made a plugin which resolves this issue:
https://masterns-studio.com/code-factory/wordpress-plugin/woo-category-base/
I’m having the same issue as Nathan. I want the same path but i’m not able to 🙁
I have exactly the same problem Nathan as well.
I’m trying to use the base ‘shop’ for categories & products. But unfortunately this will give an error in the category pages.
The only, but still worthless, solution is to change the base of the categories with ‘Shop’ (Capital ‘S’)
.com/shop — (works)
.com/Shop/{product-category} — (Only with capital ‘S’ works)
.com/shop/{product-category}/{product} — (works)
For SEO purposes this cannot be a good idea, since google will track this link as a totally different one from the original ‘shop’ base.
I therefore don’t use this structure… but I’m still looking for a right solution.
I’m 3rd to Nathan’s problem. I’m trying to use the same slug for product category base and shop base. Looks like WooCommerce doesn’t support it.
thanks!!!!! btw: I like the slide to unlock feature against spam robots, but in chrome on a mac (all updated) it works not very well, tried 5 times….
Great…! SOLVED man… I’m so glad it’s done easily with your help of course.
Tahnks a lot.
thanks!
Thanks! I realized after reading this post I was getting a 404 error clicking on my product tag cloud because I had customized the product tag base permalink. When I deleted my customization, it went back to default after saving and the 404 error went away. Yea!
I would like to thank you, my site http://www.dekorativne-rastline.si is now working fine with the URLs 🙂
Anyone found the solution yet for the /shop issue noted by Nathan?
Haven’t seen any other solution besides the ‘WooCommerce Permalink Plugin‘. It’s rather odd that WooCommerce still does not seem to be interested in supporting this..
thank yooooou 🙂 Finally you resolve my problem
Great to hear 🙂
David – does the WooCommerce Permalink Plugin actually fix the problem described by Nathan, allowing you to use the same name eg. “shop” for “product category base” and for the “product permalink base”?
I’m currently using Roel’s fix with a capital S, as that seems like a better match than having the default “product-category” in the permalink.
Thanks 🙂
Thanks for asking! Yes, this problem is fixed with the plugin.
It removes the /product & /product-category slugs completely. Then you can set a base url “shop”, so that everything is under the domain.com/shop/ path like Nathan wanted.
Not working for me… any ideas on why?
I had a problem that made my shop into one big loop. Main shop page led to Category page led to main shop, etc. This simple article fixed it for me. Thank you! Took me too long to figure out.
In short: Go to wp-admin -> settings -> Permalinks
Under Product Permalinks find the Custom Base setting and put it on ‘shop’, or whatever you want.
That fixed this for me.
I got problems till, problem it’s not solved
http://rehobothtrends.com/product-category/western-wear/
The page you linked to is here: http://rehobothtrends.com/index.php/product-category/western-wear/
I am guessing that a missing .htaccess file might have something to do with your problem.
Thanks, this fixed a problem I was having with http://www.owlbags.com.au 🙂
Glad to hear! What was it exactly that fixed your problem?
You just save my jod, my life!! Thks so much!!
Heheh. Pleasure 🙂
This solved my Wooc. problem, …merci beaucoup.
My shop base was working perfectly until recently (not sure exactly when this broke)
My product category base has always read “product-category” (and worked), now shop gives me a 404 error and changing to category makes no difference?
Have you any idea where I might start looking for this error?
all categories work fine in either configuration
custome base /wslsc-shop/%product_cat%
Hey when I remove /shop/%product_cat% then checkout and cart page is 404.
Is there any way we can set Custom Base to /%product_cat%.
Thanks
Yes — unfortunately the permalink structure can break it easily.
By using the Perfect SEO URL plugin you can remove the /shop/ slug from the URL and automatically have the canonical link element applied to avoid duplicate content issues. Thanks for asking!
So after using Perfect SEO URL plugin cart and checkout page will work right?
and product page will open as vwthemes.com/category-name/product-name
Thanks
Thank you very much. You have really saved me a lot of headache.
Great to hear that; thanks for the feedback 🙂
Saved me…thanks!
I followed the instructions but I got the same error still.
THANK-YOU!!!!!!!!!!!!!!!!!!!!!!
https://sss.com/product-category/
then error show
404!
Nothing was found at this location. Try searching, or check out the links below.
product-category page does not work. i deactivate all plugin and also clear cache and permalinks can any one tell me solution?