These two shortcodes will display your product categories on any page.
[product_category]
– Will display products in a specified product category.[product_categories]
– Will display all your product categories.
Available Product Category attributes
↑ Back to topids
– Specify product category ids listed. Used with [product_categories]category
– Can be either the category id, name or slug. Used with [product_category]limit
– The number of categories to display. Entering “0” or leaving undeclared shows all categories. (Interchangable withnumber
as shown in example)columns
– The number of columns to display. Defaults to 4hide_empty
– The default is “1” which will hide empty categories. Set to “0” to show empty categoriesparent
– Set to a specific category ID if you would like to display all the child categories. Alternatively, set to “0” (like in the example below) to show only the top level categories.orderby
– The default is order by “name”, “id”, “slug”, or “menu_order” are additional options. If you want to order by the ids you specified then you can useorderby="include"
order
– States whether the category ordering is ascending (ASC
) or descending (DESC
), using the method set inorderby
. Defaults toASC
.
Examples of Product Category Scenarios
↑ Back to topShow Top Level Categories Only
↑ Back to topImagine you only wanted to show top level categories on a page and exclude the sub categories, well it’s possible with the following shortcode.
[product_categories number="0" parent="0"]
![](https://woocommerce.com/wp-content/uploads/2012/01/woocommerce-shortcodes-top-level-categories-only.png?w=950)
Questions and Support
↑ Back to topDo you still have questions and need assistance?
This documentation is about the free, core WooCommerce plugin for which support is provided in our community forums on WordPress.org. Searching there you’ll often find that your question has been asked and answered before.
If you haven’t created a WordPress.org account to use the forums, here’s how.
- If you’re looking to extend the core functionality shown here, we recommend reviewing available extensions in the WooCommerce Marketplace.
- Need ongoing advanced support, or a customization built for WooCommerce? Hire a WooExpert agency.
- Are you a developer building your own WooCommerce integration or extension? Check our Developer Resources.
If you weren’t able to find the information you need, please use the feedback thumbs below to let us know! 🙏