• Hi

    I’ve been setting up my store for a while (it being my first WC site), and I have just noticed something which is very confusing and I don’t understand why it is the case.

    In WP Settings > Permalinks, WP allows me to type in a ‘Product category base’, which I believe just defaults to ‘product-category’.

    However, WP also allows me to set a product URL base. Currently, that is set on ‘custom base’ with /shop/%product_cat%/ as the entry. I cannot recall whether this is the default option, or whether I tinkered with this for some reason ages ago.

    The ability to make them different means that if someone visited a product, and wanted to get a category manually, or discern the product category from the URL, they would be wrong and get a 404 error.

    For example, go to prouct:

    site.com/shop/category-name/product-name

    If someone wishes to discern the category url and go there, they will try:

    site.com/shop/category-name/

    And they would get a 404 error, because the working url structure is different:

    site.com/product-category/category-name/

    Could someone experienced with WC please explain to me why anyone would want an inbuilt ability to create inconsistent URLs? I would honestly very much appreciate know the reasoning.

    What is best practice?

    Ultimately I’d just want:

    shop.com/category-name/product-name

    or

    shop.com/shop/category-name/product-name

    Is there a best practice for this? I am utterly confused.

    Another thing: If I change the custom base and remove the ‘shop’ part, that is going to wreak havoc with all my product links. Can someone please also recommend the best way to handle bulk re-directs within WP/WC without dealing with each link individually? ie. every product that once had ‘shop’ as the base, should now redirect to the url without ‘shop’, etc?

    Much appreciated.

Viewing 11 replies - 16 through 26 (of 26 total)
  • Stef

    (@serafinnyc)

    Thanks. We’re 45 mins outside the city, but one of our retail partners was destroyed and looted Saturday night.

    All our displays were destroyed and our products were stolen. Crazy times.

    Thread Starter jason9j

    (@jason9j)

    I hope they find the people who did that, now stalking Philly with glowing skin and natural lips.

    Actually, are you contactable via the site you sent me? I might take a look around, because by coincidence, those products align with our shop concept..Not saying one thing or the other, but I may note your info for future questions (not SEO), and I shouldn’t digress any more on this thread…

    • This reply was modified 4 years, 5 months ago by jason9j.
    Stef

    (@serafinnyc)

    Right LOL. Yup. I’m on @slack

    Have a great day!

    Thread Starter jason9j

    (@jason9j)

    Noted. Thanks Stef.

    Thread Starter jason9j

    (@jason9j)

    After thinking about what permalinks make the most sense, I have concluded it is this:

    Shop Base
    site.com/shop/

    Single product URLs:
    site.com/product/sample-product/

    Product Category URLs:
    site.com/shop/category-name/

    So, the word ‘shop’ is used as the shop base AND the product category base. Because, obviously, if a category name comes after ‘shop’, you know it is a product category, not a blog.

    I have no idea why WC doesn’t do this natively… Can I just go ahead and do this without consequence/conflicts etc?

    Anyone’s thoughts are appreciated.

    Stef

    (@serafinnyc)

    There you go. You’re all over it now

    Thread Starter jason9j

    (@jason9j)

    Apparently setting the shop base and the product category base to the same thing will cause a 404 error. Looks like it’s going to be one of those things…

    Stef

    (@serafinnyc)

    Sorry didn’t see your category one correctly. Go back to my urls. Those are the bases.

    Thread Starter jason9j

    (@jason9j)

    Thanks Stef. Yeah, I want to keep them the same though, as that makes the most sense. I’m investigating it now. It’s silly that I’d have to use ‘shop’ for shop base, and ‘store’ or something for product category base. I don’t understand WC logic in not allowing this.

    Thread Starter jason9j

    (@jason9j)

    Update:

    Regardless of the WP options provided, or what base I type in place of another, the problem still remains the source of my confusion:

    If I go to a product, I’m at this URL:

    site.com/shop/category/sub-category/product-name

    OK, you say as the visitor. I see the URL. Click in the browser, delete ‘product-name’, because I’d like to see everything in that category.

    That leads to a 404 error for site.com/shop/category/sub-category. Literally doesn’t exist.

    The one WP recognises is site.com/product-category/sub-category/.

    This is the confusion at the center of my original question.

    Why would WP do this?? Why would they take something logical and turn it into a 404 error by default? Why would they purposely require the visitor to be sight-familiar with a completely different URL path for no reason?

    To say ‘provide breadcrumbs’ is not an answer, as that would mean that there’s little point to a logical URL structure. Also not an answer is custom coding or a plugin, which – for something a critical as permalinks – relies on a 3rd party to flawlessly keep up with WP updates with no room for error. It is an unnecessary complication.

    Do I need to manually set up 301 redirects for every single category to cover this scenario?

    Anyone passing through this thread is welcome to let me know – much appreciated.

    • This reply was modified 4 years, 5 months ago by jason9j.
    • This reply was modified 4 years, 5 months ago by jason9j.
    Thread Starter jason9j

    (@jason9j)

    Update 2:

    It seems I had to go to the extreme lengths of installing an SEO plugin, and use that to strip out the product and product-category bases. URLs look much better now, but I hate having to rely on a heavy plugin to do it.

    My utter confusion remains as to the logic behind WP’s decisions here, but I need to move on…

    We’ll see how this solution goes, as to whether I run into any significant downside…

    • This reply was modified 4 years, 5 months ago by jason9j.
Viewing 11 replies - 16 through 26 (of 26 total)
  • The topic ‘Confusion:Why allow different product category base and custom product URL base?’ is closed to new replies.