Use wp_dropdown_categories() to display Product Categories

wp dropdown categories is a very handy function to display categories wherever you want. I use it mostly in the customizer to create options, where it requires users to select a category, perhaps for a post slider. But, sometimes we may was to show categories apart from the blog. Like, WooCommerce Product Categories.

To do so, all we need is the taxonomy created by WooCommerce for Product Categories which is  product_cat

After that, we need to use the  wp_dropdown_categories( $args ); function like we do, but in the $args , we add one more parameter:

That’s All.

Leave a Reply

Your email address will not be published. Required fields are marked *