1. Knowledge Base
  2. WooCommerce Product Table
  3. FAQ

How to use categories in WooCommerce Protect Table

Our WooCommerce Product Table plugin fully supports product categories. You can add a ‘categories’ column to the product table, sort by category, filter by category, or even list products from specific categories or sub-categories. This article summarizes the different ways in which you can use categories with WooCommerce Product Table.

Category Columns

You can list each category as a separate column in the product table. Simply add categories to your list of columns. The product categories will appear in a comma separated list.

You can rename the categories column to anything you like.

Parent and child categories/sub-categories are treated identically in the categories column. For example, in the following screenshot, ‘T-shirts’ is a child category of ‘Clothing’:

WooCommerce product table attribute columns
Product table with a ‘categories’ column.

Read the documentation on how to create product category columns.

Displaying products with a specific category or sub-category

There are two ways to list products from a specific category only: by adding a shortcode to a page, or by automatically using the product table layout on all category archive pages.

Use a shortcode to list products by category

You can create a table listing products from one or more specific categories. For example, you can list products from the ‘women’ category only. This is a good way to pre-filter the table by category.

Read the documentation on how to list products based on category.

Add the product table layout directly to all category pages

Due to the way the WooCommerce templating system works, the only way to globally add the product table to all category pages is to modify the archive-product.php template file in your theme.

To make this easy for non-coders, we’ve provided a sample template file with instructions on how to do this.

Download the sample archive-product.php file and read the instructions.

Filtering by category

Preview of WooCommerce Product Table with WooCommerce product filters

There are two ways to let customers filter the table to refine the list of products based on their categories:

Read the documentation on creating category filter dropdowns.

Sorting by category

You can sort the table by category – either when the table first loads, or by allowing customers to click on the header of the category column to sort by category.

If a product is in multiple categories then the first category will be used for sorting.

Sort by Attribute

Read the documentation on how to sort by category.

Can I list categories and sub-categories separately?

WooCommerce Product Table treats categories and sub-categories in exactly the same way, and doesn’t distinguish between the two.

The only ways to list categories and sub-categories separately are:

  • Add a categories filter above the table, and the dropdown will list the categories in a hierarchical structure with the sub-categories nested/indented under the top level categories.
  • Use the category shortcode option to list products from sub-categories separately on the page. For example, if your ‘clothing’ category has sub-categories for ‘t-shirts’ and ‘hoodies’ then you can create two products tables, one listing t-shirts and the other listing hoodies:
<h2>T-Shirts</h2>

[product_table category="t-shirts"]

<h2>Hoodies</h2>

[product_table category="hoodies"]
Still need help?
If searching the knowledge base hasn't answered your question, please contact support.

Related Articles