It’s pretty easy to add another custom menu to your WooCommerce pages via PHP. For example, you might want to add a list of Product Category links, and manage this through the default “Appearance > Menu” in the WordPress dashboard.
WP Dashboard > Appearance > Menu: create a new menu
Create a new menu called “Categories” and add the product categories you wish to it.
PHP Snippet: Add WP menu to WooCommerce pages
/** * @snippet Add WP menu to WooCommerce pages * @how-to businessbloomer.com/woocommerce-customization * @sourcecode https://businessbloomer.com/?p=22012 * @author Rodolfo Melogli, Business Bloomer * @testedwith WooCommerce 2.5.2 */ add_action( 'woocommerce_before_main_content', 'bbloomer_echo_categories_menu' ); function bbloomer_echo_categories_menu() { wp_nav_menu( array( 'menu' => 'categories', 'container_id' => 'nav_menu-2' ) ); }
Hi, thanks for your help. I tried but I received this answer from wordpress
I guess your code is causing a conflict with my theme? I’m using Enfold Theme
I guess so
THANK YOU for this! But Can I add a class to this? I want it to match my header menu with this same class:
Where would I insert the code to make it pull this one instead?
Hey Kimberly thanks for your comment! If you take a look at https://developer.wordpress.org/reference/functions/wp_nav_menu/, you can see you can also declare a parameter called “menu_class”. That should help 🙂
Hi Rodolfo,
Thanks for the code!
Is there a way to tweak this further, if we need a separate custom menu for each product?
Hey Shruti, thanks for your comment! Yes, of course, you could take a look at my conditional logic guide to see how to target a specific product ID: https://businessbloomer.com/woocommerce-conditional-logic-ultimate-php-guide/
Thank you for the code 🙂
De nada 🙂