Product table columns
WooCommerce Product Table gives you full control over the data displayed in the table. You can do this using the
The available columns are:
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:
namecolumns are self-explanatory. The
idcolumn is the product ID, assigned by WordPress when you create the product.
descriptioncolumn 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
short-descriptioncolumn 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.
datecolumn will display the date that the product was added to your store (i.e. when it was published).
tagscolumns display the list of categories/tags that the product is in. You can use the
linksoption to control whether or not these columns will link to the relevant category or tag. If
search_on_clickis enabled then clicking on the category or tag in the table will filter the table to products in that category/tag.
imagecolumn will display the main product image (see the
image_sizeoption below to set a custom size).
reviewscolumn will display the average star rating out of 5 for each product, based on previous customer reviews.
stockcolumn 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.
dimensionscolumns will display the relevant data as entered for each product under the Shipping tab.
pricecolumn 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.
add-to-cartcolumn will display the Add to Cart button for that product. You can use the
show_quantityoption to show or hide the quantity field (default is to hide the quantity field). You can also show product variations.
buttoncolumn will display a button in the table which links to the product detail page.
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:
name,categories,stock,price,add-to-cartto the Columns field on the plugin settings page, or;
- Use the following shortcode:
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
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 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 –
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 Advanced Custom Fields plugin. Create the custom fields, and then you can display them as columns in the product table.
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.
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:
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.
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 for a custom taxonomy with the slug
document_type, you would use:
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.
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.
How to display the sale price
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:
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.
- 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,add-to-cart:Choose Options"]
- 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,add-to-cart:blank"will remove the ‘Buy’ title from above the add to cart column
You can do this for as many columns as you like.