Dynamically populate woocommerce product category terms to WordPress navigation menu

Following is a snippet that lets you dynamically populate woocommerce product category terms to WordPress navigation menu. This code only add sub product category to wordpress navigation menu if the woocommerce parent category already exists in wordpress navigation menu.

Following is a function that helps you to make menu item object. You can copy code to functions.php

Following is snippet dynamically adds woocommerce product subcategories to wordpress navigation menu if any woocommerce product category exists in wordpress menu.

In the above code you need to change the menu id to make it work on your theme.

You can find complete code in Custom taxonomy term to WordPress menu

This snippet is built to solve the problem mentioned here. Modify custom menu function for automatic hierarchy and exclusion of empty product categories WooCommerce

Feel free to comment below or drop a message if you need any assitance.

Dynamically populate woocommerce product category terms to WordPress navigation menu.
automatically add categories to menu wordpress
wordpress auto populate menu
add custom category to menu wordpress
display custom taxonomy in menu wordpress
woocommerce populate products dynamically
prepopulate product category, auto populate woocommerce product category.
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.