This is the solution I found that works:
As usual in these cases, override the archive product template from your woocommerce plugin folder by copying archive-product.php
to yourtheme/woocommerce/archive-product.php
. Edit the file, and add this code at the beginning (or wherever the menu needs to show up):
<?php
if ( is_tax( 'product_cat', 'cat1' )) {
wp_nav_menu( array( 'theme_location' => 'menu1' ) );
}
elseif ( is_tax( 'product_cat', 'cat2' )) {
wp_nav_menu( array( 'theme_location' => 'menu2' ) );
}
else ( is_tax( 'product_cat', 'cat3' )) {
wp_nav_menu( array( 'theme_location' => 'menu3' ) );
}
?>
menu1 will be displayed when we’re on the products page that belongs to category cat1.
menu2 will be displayed when we’re on the products page that belongs to category cat2.
And so on.
Related Posts:
- Reflect nested categories in appearance > menus
- Display WooCommerce product categories in a 4 columns custom menu [closed]
- Add Product categories to WordPress menu without losing hierarchy
- Building Menu from Woocommerce Product Categories
- List a maximum of ‘x’ product categories with qty of ‘y’ in each column
- How to add all subcategories as submenu in WordPress menu
- WordPress category title not update in navigation menu
- Category menu that filters out empty categories
- How can I add a Categories page link to a menu? [closed]
- Update wordpress menu with woocommerce products
- Retrieve Product category ‘NAME’ by product category ID – WooCommerce?
- Custom Nav Walker menu – Display category count
- Category menu item and its last 10 posts as sub-menu
- Remove child products from woocommerce category page [closed]
- Keep active class in post page
- How to show empty category in admin menus search
- Use get_term_children to get the sub category of a parent category for the current post
- Hide uncategorized products from the shop page
- Remove word “Category” from WooCommerce product page [closed]
- Filtering search results
- WooCommerce change category url and product base
- Output link to category from WP_Query loop of woocommerce products
- display woocommerce all category title on home page
- Add Icons to the Product Category Sidebar Widget WooCommerce
- How to get product count with respect to categories in WooComerce
- Custom page for WooCommerce’s /product-category/
- Get woocommerce catogry
- get_cat_ID() not wokring
- Display child categories in WooCommerce
- WooCommerce duplicate sub categories and product slugs
- Open subcategories in submenu on click in primary menu
- Set post categories to include parents when setting child category
- WooCommerce IF statements not working
- Linking products to categories
- Warning: sizeof (): Parameter must be an array or an object that implements Countable, On products pages
- Omit specific product categories from WooCommerce shortcode
- Nav menu category links not showing
- Multiple Domain Names – One WP Install (non-Multisite) – Default Each Domain name to Product Category WooCommerce
- How to show only one category in breadcrumb navigation
- Hard coded main navigation
- Hide woocommerce category name from specific pages
- Hide woocommerce category name from specific pages
- 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]
- Categories for each brands
- WordPress/Woocommerce only show category in shop to a single role
- WooCommerce – How to show specific category first-rest of products-specific category last
- Woocommerce custom category page with pagination [closed]
- Menus don’t work after 4.4 [closed]
- category permalinks
- Create menu / submenu from category subcategory and posts
- Redirect to another page using contact form 7? [closed]
- Admin: Navigation Menus do not show empty categories/taxonomies in the list’s search tab
- Do not show sub categories in the loop on archive-product.php
- why get_the_post_thumbnail( the_ID()) echos extra post id
- How to access deleted term inside delete_product_cat action
- Apply WordPress function on specific woocommerce product categories only
- Filter WooCommerce archive pages by an additional category
- Grandchild Term Things Grandfather Term is It’s Parent
- How do order product categories – on a parent category page – in Woocommerce?
- Woocommerce filter function not updating
- How can i change what one category displays?
- Remove any product that is featured from regular display loop [WooCommerce]
- Two Sections on Woocommerce Catergory Page [closed]
- Woocommerce search form with category select
- How to Sync Menu, Widgets and other masters from Main Website to its Sub Site
- Theme modification for custom category menus
- Change appearance based on category but post is in two main categories
- Is custom menu name and category name linked in wordpress?
- How to automatically generate custom menu item from categories?
- WooCommerce shared categories
- WP-CLI Add category as menu item main-menu
- Displaying Single Product Page Parent and Child Category
- Conditional label Woocommerce archive [unsolved]
- How to show given products only using product id array from specific category page in woocommerce
- WooCommerce REST API not returning the default products category
- How to show WooCommerce Categories on ‘shop’ page instead of products?
- How can I display all products from all categories on one page with woocommerce?
- How to remove an item from a custom Walker_Nav_Menu
- Get WooCommerce product category list in functions.php
- Is there a reason to put a product in both the Child and Parent Categories?
- Function add class to second menu specific items if the page has a certain category
- Dynamically display sub-categories on primary menu without adding them
- WooCommerce showing active product categories on single product page
- Woocommerce product catalog, products with different description
- set a parent category in a product woocommerce
- No results found for second level category
- How to display products with multiple conditions, product_id and category_id
- Tag Menu items based on their categories
- How to get related category/categories in WordPress archive page
- Hide category links if there is nothing in the categories – Main Navigation submenu item
- Conditions for single post
- woocommerce – products by category slug? [closed]
- Automatic menu creation for pages with categories?
- Right way for setting categories
- Chained drop-down menu for custom taxonomy using chained.js
- How to prevent uppercasing of menu titles
- Woocommerce Force the category choice before creating new product? [duplicate]
- Restricted category in Woocommerce [closed]