Got to Settings -> Permalinks ->
In ‘Product permalink base’ select the ‘Shop base with category’ option.
After saving if the .htaccess file is not writable then WordPress prompts you to create the .htaccess file and add the code which the mention after saving in the .htaccess file.
The reason that it is giving 404 error is that the Permalink structure needs the code to be added to .htaccess file or the settings which you saved will only apply when not using “default” permalinks for ‘Common Settings’.
Related Posts:
- How to get permalinks with category base working with sub-categories
- Catch 404 after changing permalink structure from /%postname%/ to /%category%/%postname%/
- Multiple post categories – single permalink
- How to create a custom url for a category [closed]
- How to Include the Parent and Child Category in the Permalink if the Post is Added to Both
- Exclude subcategories from the url
- Add “page-a” slug to category link if user visit category link from “page-a”
- Remove subcategory and category with some rules from permalink
- Hierarchical permalink structure for posts showing categories and sub-categories
- A different permalink structure for different categories
- How to remove category name for only one category?
- Category URL’s 404 after setting category base to ‘.’
- Accessible Subcategory URL’s pages without using .php hack
- Catch 404 after changing permalink structure from /%postname%/ to /%category%/%postname%/
- Multiple Parent Category URLs
- Custom permalink structure leads to be 404 on pagination
- Retrieve Product category ‘NAME’ by product category ID – WooCommerce?
- What’s the URL for a category archive?
- How to get the url to tag & category base set by the user?
- Best and Cleanest way to remove /category/ from category permalinks? [duplicate]
- Root level category, tag, author and archive pages to work
- Archive pagination causing 404 with permalinks structure
- Use get_term_children to get the sub category of a parent category for the current post
- Remove word “Category” from WooCommerce product page [closed]
- Filtering search results
- Get woocommerce catogry
- Allow dot in wordpress permalinks (only for categories)
- Using a portfolio_category slug in wordpress URL
- How to get category URL with the slug?
- Set post categories to include parents when setting child category
- Omit specific product categories from WooCommerce shortcode
- WordPress subcategories return 404 in custom template
- force category base – archive pages work WITH & WITHOUT category base slug in url?
- How get permalink for the current category or tag?
- need to add custom field in more products
- How to redefine the sorting of product categories by menu_order?
- Pagination is not working properly in Product Category/Tag pages
- How to recreate a copy of a product category in WooCommerce? [closed]
- Get parrent category name
- Sorting category products not working
- Sub Categories Keep Redirecting to Pages With Same Slugs
- A single category with a specific permalink structure differing from the standard set for the rest of the site
- category url structure
- menu using category and tags
- Remove the parent name from permalink
- Redirect to another page using contact form 7? [closed]
- Redirect single article permalink to paginated category page
- Hide the word ‘category’ from my permalinks
- WordPress alphabetical A-Z custom post type post result display
- Building Menu from Woocommerce Product Categories
- Use the category name instead of category slug in permalinks
- Function to automatically rename the base category permalink
- List just subcategory and products of active category page in Woocommerce
- why get_the_post_thumbnail( the_ID()) echos extra post id
- Filter WooCommerce archive pages by an additional category
- Custom tax_query filter not working for Woocommerce product categories
- How do order product categories – on a parent category page – in Woocommerce?
- Remove any product that is featured from regular display loop [WooCommerce]
- Two Sections on Woocommerce Catergory Page [closed]
- Woocommerce search form with category select
- category link not working for a specific slug, works for others
- Pagination breaks on child-categories, works fine on parent-category
- Is the part “category” fixed to an URL to an archive or post?
- prefix to post permalinks without affecting category permas
- Category URL Management
- Displaying Single Product Page Parent and Child Category
- WordPress Primary Category Changes After Import, Permalink Issue
- Using custom structure prefix showing 404 for sub-categories
- How to add tags under categories
- Conditional label Woocommerce archive [unsolved]
- One Time Access URL after purchasing subscription
- Get category base permalink
- How to show WooCommerce Categories on ‘shop’ page instead of products?
- Is there a reason to put a product in both the Child and Parent Categories?
- WordPress category title not update in navigation menu
- Wrong category in URLs accepted like the correct one
- WooCommerce showing active product categories on single product page
- Remove “category” from permalink with add_rewrite_rule
- Change Category Base For Custom Post Type or Posts Page
- set a parent category in a product woocommerce
- No results found for second level category
- same permalink for parent category and child category
- /blog/ permalink prefix causes category pages to 404
- Create monthly archive for parent category
- Change category base based on category
- woocommerce – products by category slug? [closed]
- How can I add a Categories page link to a menu? [closed]
- Modify / Rewrite single template url structure
- Most efficient use of custom taxonomies, categories, and pages
- Removing short versions of category archive URL
- Change next_post and previous_link to navigate throught parent categories only
- how wordpress generates permalinks as /%category%/%post%/
- How to get the perfect WordPress, WooCommerce, Custom Post Type pretty permalinks?
- Woocommerce Force the category choice before creating new product? [duplicate]
- Custom EndPoint not working when strip child category in URL
- Remove “?category=” in the URL wordpress ajax filter work for category
- Function to reference post meta in place of category Woocommerce
- How to add custom prefix before category base for category page URL?
- Add custom fields to Woocommerce Category Page
- How to remove the category from the url only for a specific category of articles on wordpress