How To Fix WooCommerce Shop Base Permalink 404 Error

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.

WooCommerce 404 Error


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..!

43 thoughts on “How To Fix WooCommerce Shop Base Permalink 404 Error”

      • 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.

        Reply
  1. 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!

    Reply
  2. 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

    Reply
  3. 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)

    Reply
  4. 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.

    Reply
  5. 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….

    Reply
  6. 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!

    Reply
  7. 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 🙂

    Reply
    • 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.

      Reply
  8. 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.

    Reply
  9. 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%

    Reply
    • 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!

      Reply
      • 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

        Reply

Leave a Reply to PermacultureIT Cancel reply