Product Category Shortcodes
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
ids– 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 withnumberas 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
Show Top Level Categories Only
Imagine 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"]
