Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon What are the common attributes used with the [product_categories] shortcode


What are the common attributes used with the [product_categories] shortcode


The `[product_categories]` shortcode in WooCommerce allows you to display a list of product categories on your site. Here are the common attributes you can use with this shortcode:

Common Attributes for `[product_categories]`

- ids: Specify particular categories to display by their IDs (e.g., `ids="1,2"`).

- limit: Control the number of categories shown. The default is to show all categories.

- columns: Set the number of columns for the layout. The default is 4.

- hide_empty: Set to `1` to hide categories that do not have products, or `0` to show all categories regardless of whether they contain products.

- parent: Use `0` to show only top-level categories, or specify a category ID to show its subcategories.

- orderby: Determine the sorting method for categories. Options include `name`, `id`, `slug`, `menu_order`, or `include` (if you specified IDs).

- order: Set the order of categories to `ASC` (ascending) or `DESC` (descending). The default is `ASC`.

Example Usage

plaintext
[product_categories ids="1,2" limit="5" columns="3" hide_empty="0" parent="0" orderby="name" order="ASC"]

This example would display up to 5 categories with IDs 1 and 2, arranged in 3 columns, including empty categories, showing only top-level categories, ordered by name in ascending order.

These attributes provide flexibility in how categories are displayed, making it easier to customize the presentation on your WooCommerce site [2][3][4][5].

Citations:
[1] https://wordpress.org/plugins/wcpas-product-attributes-shortcode/
[2] https://woocommerce.com/document/woocommerce-shortcodes/products/
[3] https://wpdesk.net/blog/woocommerce-shortcodes/
[4] https://webappick.com/woocommerce-product-shortcode/
[5] https://www.storeapps.org/woocommerce-categories-shortcodes/