1. Home
  2. Knowledge Base
  3. WooCommerce Product Table
  4. Product Table Shortcode Options
  5. Product table columns

Product table columns

WooCommerce Product Table gives you full control over the data displayed in the table. You can do this using the columns option.

Available columns

The available columns are: sku, idname, description, short-description, date, categories, tags, image, reviews, stock, weight, dimensions, price, add-to-cart, and button. You can also add columns for any product attribute, custom field or custom taxonomy term.

You can choose as many columns as you want and in any order. You must separate each column with a comma. It doesn’t matter if there are spaces before or after the comma.

WooCommerce table plugin column options

Table with columns for SKU, name, categories, tags, image, reviews, stock, price, & add to cart

Here’s an example displaying the product name, categories, stock level, price and add to cart button:
[product_table columns="name,categories,stock,price,add-to-cart"]

  • The sku and name columns are self-explanatory. The id column is the product ID, assigned by WordPress when you create the product.
  • The description column will show the full product description, shown under the “Description” tab on the product page. The description is truncated to 15 words but you can customise this using the description_length option.
  • The short-description column will display the Product Short Description entered on the Edit Product screen. The is normally displayed on your product page just before the price and add to cart button.
  • The date column will display the date that the product was added to your store (i.e. when it was published).
  • The categories and tags columns display the list of categories/tags that the product is in. You can use the links option to control whether or not these columns will link to the relevant category or tag. If search_on_click is enabled then clicking on the category or tag in the table will filter the table to products in that category/tag.
  • The image column will display the main product image (see the image_size option below to set a custom size).
  • The reviews column will display the average star rating out of 5 for each product, based on previous customer reviews.
  • The stock column will show the current stock level for the product. There are various settings in WooCommerce which control how the stock level is displayed (see WooCommerce > Settings > Products > Inventory), and this column will change based on these settings.
  • The weight and dimensions columns will display the relevant data as entered for each product under the Shipping tab.
  • The price column will display the current product price. If there are variations for the product then the price is displayed as a range – e.g. “$2.99 – 5.99”. If the product is currently on sale, then the sale price is shown with the original price crossed out next to it.
  • The add-to-cart column will display the Add to Cart button for that product. You can use the show_quantity option to show or hide the quantity field (default is to hide the quantity field). You can also show product variations.
  • The button column will display a button in the table which links to the product detail page.

Product attribute columns

You can display any product attribute as a separate column in the table using the format att:<attribute name>. Here’s an example with columns for the attributes color and size:

[product_table columns="name,att:color,att:size,add-to-cart"]

You need to use the attribute “slug” here, which can be found under the Products -> Attributes menu in the WordPress admin.

If you want to show a custom product attribute (i.e. an attribute added just for one product), use the attribute name you entered on the Attributes tab for that product.

WooCommerce product table attribute columns

Product table with attribute columns for color & size

Custom field columns

You can also add custom fields to your table using the format cf:<field name>. This is a good way to store extra data within custom columns in the product table.

If you are using Advanced Custom Fields, the field name can be found under the “Field Name” column in the Custom Fields menu. Here’s an example adding two custom fields – product_meta and product_expiry:

[product_table columns="name,description,cf:product_meta,cf:product_expiry"]

Custom fields are an opportunity to include other types of content in the table. You can use them to store various data such as links, buttons, icons and shortcodes from other plugins. You will need to add the full HTML code or shortcode to the custom field so that the product table can display it correctly. If you’re using shortcodes, you will need to set shortcodes to true.

WooCommerce product table custom field columns

Product table with a custom field called ‘Link’ containing links, icons & buttons

Custom fields created using the Toolset Types plugin

If you’re using Toolset Types to create your custom fields, then you need slightly different syntax to display them in the product table.

Toolset adds wpcf- to the start of the custom field name, so if you create a custom field called ‘link’ (for example) then the correct syntax will be wpcf-link. This means that if you want to create a product table with columns for name and a custom field called ‘link’ then you would need to add it as follows:
[product_table columns="name,cf:wpcf-link"]

Custom taxonomy columns

To add taxonomies to your table (other than product categories and tags), use the format tax:<taxonomy slug> in the columns option. So, for example, to display for a custom taxonomy with the slug document_type, you would use:
[product_table columns="name,description,tax:document_type"].

You can find the taxonomy slug by going to the WordPress admin and finding the page which lists the taxonomy terms. For example, WooCommerce product categories are edited under the Products -> Categories menu. On that page, the URL at the top of the screen shows “…edit-tags.php?taxonomy=product_cat….” The ‘product_cat’ part after the equals (=) is the taxonomy slug you need to use.

Choosing your own column headings

You can set custom column headings by adding a : (colon) after the column name. You can add custom headings for any column in the table. If you don’t set one then the default heading will be used.

For example, the default heading for the product name is “Name”, but if you wanted the heading “Product Name” instead, you would use:
[product_table columns="name:Product Name,date,price"]

Example using several custom headings:
[product_table columns="name:Item Name, date:Added, cf:field1:Details, price:Cost Per Unit"]

Product table WooCommerce with custom column heading text

Product table with custom headings for SKU, tags, reviews, stock & price

Removing the column heading

If you would like to remove a column heading completely, use the keyword blank after the colon. For example: columns="name:blank,description,categories,price"

WooCommerce product table blank column headers

Product table with blank column headers. Only the sort arrows are visible

Was this article helpful?

Related Articles