Contents
How to display all subcategories in WooCommerce?
Show WooCommerce Sub Categories on Shop Page
- Click on Appearance > Customize.
- Then go to WooCommerce > Product Catalog.
- Select “show subcategories” from Category Display.
- Click on Save Changes.
How to display categories and subcategories in WordPress?
For what we want to achieve, enter the /Êtegory%/%postname%/ in the field next to the Custom Structure. Click on Save Changes. That’s all. WordPress will now start adding categories and subcategories for a post in the URL.
How to display categories, subcategories, and products?
Now, let’s take a look at how WooCommerce displays the product categories and products on archive pages. If you haven’t already, open the Customizer, select the WooCommerce tab, and click on Product Catalog. Under Shop page display, select Show categories & products, and under Category display, select Show subcategories & products.
How to display the subcategories from a specific category in PHP?
However, as the number of categories and subcategories increases, it is more attractive to get subcategories of a certain category programmatically or through PHP code. In this way, you would be able to show a list of subcategories on the category pages themselves.
What are the subcategories of a clothing category?
Under these main categories are sub-categories like men’s wear, women’s wear, and children’s wear, all under the Apparel parent category. In this case, WooCommerce’s product categories feature would come in handy.
How to display categories, subcategories, and products in WooCommerce?
Unfortunately that doesn’t quite work as WooCommerce has built-in styling for clearing items, which would appear at the beginning of a row with the default display. So instead of that, we’ll turn off display of categories and subcategories on our archive pages, so that just products are displayed.