Product table columns
Our WooCommerce Product Table WordPress plugin lists your products in a table, with columns of information about each product. You can use the columns
option to choose which columns to include in the table.
Available columns
The available columns are: sku
, id
, name
, description
, summary
, date
, date_modified
, categories
, tags
, image
, reviews
, stock
, weight
, dimensions
, price
, buy
, and button
. You can also add columns for any product attribute, custom field or custom taxonomy term.
Some additional column also become available when you use WooCommerce Product Table with certain other plugins:
- If you're using WooCommerce Product Table with our WooCommerce Quick View Pro plugin, then you can also add a
quick_view
column. - If you're using WooCommerce Product Table with our WooCommerce Discount Manager plugin, then you can add a
discount_content
column. This displays the Product page content field for each discount. - Alternatively, if you're using WooCommerce Product Table with our WooCommerce Lead Time plugin, then you can add a
lead_time
column. - If you're using WooCommerce Product Table with YITH's Request a Quote plugin then you can display a 'Request a Quote' button for each product by adding a
request_quote
column.
You can choose as many columns as you want and in any order:
- The
sku
andname
columns are self-explanatory. Theid
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 thedescription_length
option. - The
summary
column will display the product short description entered on the Edit Product screen. This is normally displayed on your product page just before the price and add to cart button. The summary column will display an excerpt from the main product description if the short description isn't available. - The
date
column will display the date that the product was added to your store (i.e. when it was published). - The
date_modified
column will display the date that the product was last updated. - The
categories
andtags
columns display the list of categories/tags that the product is in. You can use thelinks
option to control whether or not these columns will link to the relevant category or tag. Ifsearch_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 theimage_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
anddimensions
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
buy
column will display the Add to Cart button for that product. You can use thequantities
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. - The
quick_view
column adds 'Quick View' buttons to the product table. This column is only available if you are also using our WooCommerce Quick View Pro plugin. You can rename the buttons and add or remove an icon on the Quick View Pro plugin settings page. (Learn more about using the two plugins together.) - The
lead_time
column adds a column containing the lead time for each product. This column is only available if you are also using our WooCommerce Lead Time plugin. You can set a lead time globally or for individual products, and you can choose what text appears before the lead time (e.g. 'waiting time', 'processing time', etc.).
Please note that column names are case-sensitive and should always be lowercase. (If you're using custom column headings then these can be any case.)
How to choose your columns
To choose which columns appear in the product table, you can either list the column names on the plugin settings page, or you can add a columns option directly to the shortcode.
You must separate each column with a comma. It doesn’t matter if there are spaces before or after the comma.
For example, let's say you wanted to create a product table with columns for product name, categories, stock level, price and add to cart button. To do this, you would either:
- Add
name,categories,stock,price,buy
to the Columns field on the plugin settings page, or; - Use the following shortcode:
[product_table columns="name,categories,stock,price,buy"]
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,buy"]
You need to use the attribute “slug” here, which can be found under the Products → Attributes menu in the WordPress admin.
Should I use global or product-specific attributes?
We generally recommend adding your attributes globally under Products → Attributes and then selecting them for each product. This is because global attributes are easier to use for multiple products, and you can only have filter dropdowns for global attributes.
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. You can display this as a column in the product table, and (unless you're using lazy load), customers can click on a column header to sort by that column.
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 haven't created your custom fields yet, please see this article.
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.
Tip: If you haven't created your custom fields yet, we recommend the free Easy Post Types and Fields plugin. Create the custom fields, and then you can display them as columns in the product table.
Custom fields created using the Toolset plugin
If you're using Toolset to create your custom fields, then you need a 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"]
ACF repeater fields
If you're using Advanced Custom Fields Pro repeater fields, you can create a column using the name of the parent repeater field. This column will list the content of all the repeater fields for that product, separated by commas. It is not possible to display repeater sub-fields as separate columns in the table.
ACF group fields
Please see our separate article on how to display sub-fields which are part of an ACF group field.
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. This will display a custom taxonomy in a column of your product table.
So, for example, to display 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.
If you want to create a custom taxonomy, we recommend using the free Easy Post Types and Fields plugin. The plugin is perfect for creating and managing custom WordPress taxonomies, fields, and post types. If you want a step-by-step guide for the same, check out this guide: Creating custom taxonomies in WordPress
Stock column
The stock
column will either contain the basic stock status (e.g. 'In Stock' or 'Out of Stock') or the exact stock level. This is controlled in the main WooCommerce stock settings - WooCommerce > Settings > Products > Inventory. This page contains options on whether you wish to display the overall stock status or the exact stock quantity for each product.
Total sales column
WooCommerce has a custom field called total_sales
which stores the total number of sales for each product. You can display this as a column in the table by using cf:total_sales
in the columns option.
For example:
[product_table columns="name,summary,cf:total_sales,price,buy"]
Sale price column
By default, the sale price for your WooCommerce products will appear in the main 'price' column. The usual price will be crossed out and the sale price will be shown.
If you like, you can also display the sale price in its own column. The sale price in WooCommerce is a custom field called cf:_sale_price
. This means that you can display the sale price as a custom field column (see instructions above). For example, your shortcode might be: [product_table columns="name,cf:_sale_price,buy"]
![WooCommerce display sale price](https://barn2.com/wp-content/uploads/2018/06/WooCommerce-display-sale-price-770x290.jpg)
Product table with 'Price' column showing the main price crossed out with sale price; plus separate sale price custom field column
Creating custom columns
Developers can use custom columns to display data programmatically which is not available as one of the standard table columns.
Choosing your own column headings
You can set custom column headings by adding a : (colon) after the column name. This works whether you're listing columns on the plugin settings page, or directly in the shortcode. 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"]
- You can rename the 'Buy' column to 'Choose options' like this:
[product_table columns="name,buy:Choose Options"]
- You might want to change the capitalization of the column headings, like this:
[product_table columns="name:NAME,buy:ORDER"]
- Example using several custom headings:
[product_table columns="name:Item Name, date:Added, cf:field1:Details, price:Cost Per Unit"]
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"
will remove the heading from the 'name' column.columns="name,buy:blank"
will remove the 'Buy' title from above the add to cart column
You can do this for as many columns as you like.
How to hide a column
You can easily hide columns simply by removing them from the list of columns in the table. This will remove the column from the table.
If you wish to hide a column on specific devices only (e.g. mobiles or tablets), please see the column_breakpoints option which allows you to do this.