admin管理员组文章数量:1122826
I am trying to set up WooCommerce permalinks to get something like:
example/shop/
=> Shop page listing productsexample/shop/category-name/
=> Category page listing products from a categoryexample/shop/category-name/product-name/
=> Product page showing product details
But I have a 404 not found error when trying to open the category page.
What I did is:
I created a "Shop" page and I set it as the shop page in WooCommerce settings. OK: The page works fine and is displaying all products.
In WordPress permalinks settings, I set the product category base to "shop". KO: When I try to display a category page, WP returns a 404 error (but links are properly generated in the shop page sidebar and 404 error occurs while clicking on them).
In WordPress permalinks settings, I set the product permalink to "/shop/%product_cat%". OK: Products pages are displaying without issue.
Any way to solve this?
I am trying to 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 categoryexample.com/shop/category-name/product-name/
=> Product page showing product details
But I have a 404 not found error when trying to open the category page.
What I did is:
I created a "Shop" page and I set it as the shop page in WooCommerce settings. OK: The page works fine and is displaying all products.
In WordPress permalinks settings, I set the product category base to "shop". KO: When I try to display a category page, WP returns a 404 error (but links are properly generated in the shop page sidebar and 404 error occurs while clicking on them).
In WordPress permalinks settings, I set the product permalink to "/shop/%product_cat%". OK: Products pages are displaying without issue.
Any way to solve this?
Share Improve this question edited Dec 24, 2015 at 0:21 Gabriel 2,24810 gold badges22 silver badges24 bronze badges asked Dec 23, 2015 at 17:26 Seb33300Seb33300 1691 gold badge1 silver badge4 bronze badges 2- It is impossible to answer "something do not work as expected" type of quetions without full details about your settings. Did you try to turn off plugins, switch theme? anything interesting about your server setup? etc... – Mark Kaplun Commented Dec 24, 2015 at 5:46
- If you want to fix the 404 try this code - stackoverflow.com/questions/28221920/… – Jon Commented Jan 26, 2018 at 11:55
3 Answers
Reset to default 11Under Custom Base where you have used /shop/%product_cat%
needs to be replaced with /shop/%product-category%
Please see screenshot below:
Turns out you don't need to use %product-category% as this does create an issue with the permalinks, that variable name is left in the links, and not the actual product category.
Just leave Category base blank, that is what seems to have been causing the 404 error conflict. With the settings below, all is working:
example.com/store/ => Shop page listing products
example.com/store/category-name/ => Category page listing products from a category
example.com/store/category-name/product-name/ => Product page showing product details
I trid the page:
- https://my-site-name.com/product-category/iphones/ - I get SUCESS
- https://my-site-name.com/product-category/iphones/iphone-16-pro/ - I get 404 NOT FOUND
The issue was that I did not created the category "iphone-16-pro" in Woocommerce, the solution is:
- Naviage to: Products > Categories
- Create a category named: "iPhone 16 Pro", slug: "iphone-16-pro"
It was solved.
本文标签: permalinksWooCommerce return 404 on category pages
版权声明:本文标题:permalinks - WooCommerce return 404 on category pages 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736282071a1926526.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论