Categorizing products is a great a way to de-clutter your WooCommerce shop and intuitively guide users to the page they are looking for. In WooCommerce you can easily group your similar products under a category, making it easy for users to scan and find the products.
For Example, if you sell T-shirts, Shirts, Pants, and Sunglasses you can easily categorize T-shirts, Shirts, and Pants under “Clothing” category and Sunglasses under “Accessories”.
In WooCommerce shop or archive pages you can display only products, only categories or both products and categories together. In this article we will see how to create WooCommerce categories and display them on shop or archive pages.
Displaying WooCommerce Product Categories
Show Product Categories on Homepage
If your theme is WooCommerce compatible and has a homepage template that has WooCommerce sections, then you will be able to display product categories on Homepage. Otherwise you will have to display product categories using WooCommerce category shortcodes.
Show Product Categories on any Page
You can display product categories on any page using the following shortcodes supplied with WooCommerce.
[ product_category ]
– Display all the products of a certain category[ product_categories ]
– Display all product categories
Let’s see how to display WooCommerce product categories on a page.
- Go to Dashboard -> Pages and select any page
- Write the shortcode
[ product_categories ]
to display all categories - If you want to more control, you can use below parameters to modify what you want to display.example:
[ product_categories parent="0" ]
- Click on Publish after making the changes.
Product Category Shortcode parameters:
Parameter | Accepted Value | Description |
number | 12 | Number of categories you want to display |
orderby | ID | title | name | Order the product by |
order | ASC, DESC | Determines the order of the categories, whether ascending or descending. |
columns | 3 | Number of columns |
hide_empty | 0 | 1 | 1 to hide category which don’t have any products listed under them. |
parent | 0 | 1 | 0 to display only the parent categories and 1 to display all categories (with sub-categories) |
ids | 12 | comma separated list of category IDs |
Your blog is a treasure trove of valuable insights and thought-provoking commentary. Your dedication to your craft is evident in every word you write. Keep up the fantastic work!