Use these two shortcodes to display product categories on any page of your WooCommerce store. The [product_category] shortcode displays products from a specific category, while [product_categories] displays a grid of your product categories.
[product_category]— Displays products belonging to a specified category. Requires thecategoryattribute to identify which category to show.[product_categories]— Displays a grid of product category tiles, each showing the category image, name, and product count. Supports filtering by ID, parent category, and sort order.
Insert a shortcode into a page
↑ Back to topTo add a product category shortcode to a page or post:
- Open the page or post in the WordPress block editor.
- Click the + inserter button and search for the Shortcode block.
- Add the block to your page and paste the desired shortcode into the text field.
- Click Publish or Update to save your changes.
If you use the Classic Editor, paste the shortcode directly into the page content area.
WooCommerce also provides product category blocks as a block-based alternative to shortcodes. For details, see the WooCommerce Blocks documentation.
product_categories shortcode attributes
↑ Back to topThe following attributes customize which categories the [product_categories] shortcode displays and how they appear:
ids— Specify category IDs to display. Only the listed categories appear.limit— The number of categories to display. Enter0or leave undeclared to show all categories. Interchangeable withnumber.columns— The number of columns to display. Defaults to4.hide_empty— Defaults to1, which hides empty categories. Set to0to show empty categories.parent— Set to a specific category ID to display all its child categories. Set to0to show only top-level categories.orderby— Defaults toname. Other options includeid,slug, andmenu_order. To order by the IDs you specified, useorderby="include".order— Sets whether the category ordering is ascending (ASC) or descending (DESC), using the method set inorderby. Defaults toASC.
product_category shortcode attributes
↑ Back to topThe following attributes customize which products the [product_category] shortcode displays and how they appear:
category— The category ID, name, or slug. This attribute is required.limit— The number of products to display. Defaults to showing all products in the category. Interchangeable withper_page.columns— The number of columns to display. Defaults to4.orderby— Defaults totitle. Other options includedate,id,menu_order,popularity,rand, andrating.order— Sets whether the product ordering is ascending (ASC) or descending (DESC). Defaults toASC.
Shortcode examples
↑ Back to topDisplay products from a specific category
↑ Back to topTo display products from a single category, use the [product_category] shortcode with the category attribute. You can use the category slug, name, or ID. The following example displays up to 8 products from the “clothing” category in 4 columns, ordered by popularity:
[product_category category="clothing" limit="8" columns="4" orderby="popularity"]
This shortcode produces a grid of product tiles from the specified category, each showing the product image, name, price, and an add-to-cart button.
Show top-level categories only
↑ Back to topTo display only top-level categories on a page and exclude subcategories, use the following shortcode. Setting parent to 0 limits the output to categories that have no parent, and setting number to 0 removes any limit on the number of categories shown.
[product_categories number="0" parent="0"]
The shortcode above produces a grid of top-level product category tiles, each showing the category image, name, and product count.

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. By searching this forum, 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 Woo Agency Partner.
- 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.