WooCommerce / Product Table
Columns decide what each product table shows, and in what order. Set them on the shortcode, in the Product Table block, or as the default under WooCommerce → Product Table → Table Defaults.
List columns in the order they should appear. The built-in default, before you save Table Defaults, is image,name,summary,price,buy.
| Column | Shows |
|---|---|
id | Product ID. Linked when links are on. |
sku | SKU. Linked when the SKU is not empty and links are on. |
name | Product name, linked to the product page. Variation rows can use a different name format. |
summary | Short description. Falls back to the full description. Trimmed to 15 words unless you change description_length. |
description | Full description, also trimmed to description_length words. |
image | Thumbnail, or the parent image on a variation with no image of its own. Placeholder if there is no image. |
price | WooCommerce price HTML, including sale price. |
buy | Add to cart, or a checkbox when cart_button="checkbox". |
button | A “Show details” link to the product. Change the label with button_text. |
categories | Linked category names. |
tags | Linked tag names. |
stock | “In stock”, a quantity such as “12 in stock”, or “Out of stock”. |
date | Published date. Format with date_format, using a PHP date format. |
weight | Product weight, with the store weight unit. |
dimensions | Length × width × height. |
Image, buy, and the details button cannot be sorted by clicking the heading. Every other column can.
Rename a built-in heading with column:Heading. The name before the colon is still the column. The text after it is only the heading.
[yh_wc_product_table columns="sku:Code,name:Item,price:Cost,buy:Add"]
| Prefix | Example | Shows |
|---|---|---|
cf: | cf:warranty | One text custom field (post meta) for that key. |
att: | att:color | A product attribute. Use the slug, not the label, and do not add pa_. |
tax: | tax:product_brand | Terms from a custom taxonomy, separated by commas. |
[yh_wc_product_table columns="image,name,cf:warranty,att:color,tax:product_brand,price,buy"]
A custom field column prints a single text value. Serialized data, images, and repeaters come out blank or as raw text. The meta key is read in lowercase, so cf:Brand will not match Brand.
Headings for these columns are the name after the prefix, such as “color” or “warranty”. Custom column:Heading names are for the built-in columns above.
| Attribute | Default | Notes |
|---|---|---|
image_size | 70x70 | Pixels, such as 150x150, or a named size such as thumbnail or woocommerce_thumbnail. |
lightbox | true | Click the thumbnail to open a larger image. Set false to turn that off. |
description_length | 15 | Word count for summary and description. -1 shows the full text. 0 shows nothing. |
shortcodes | false | Run shortcodes inside the summary and description, and skip the word trim. |
wrap | true | Let long cell text wrap. false keeps it on one line. |
links defaults to all. Product name, SKU, ID, categories, and tags link through. links="none" prints plain text. Or pass column names, such as links="name,sku".
Logged-out visitors lose any column listed in hide_columns_guest. Logged-in customers still see them. If that would remove every column, the table keeps the name column.
[yh_wc_product_table columns="sku,name,price,buy" hide_columns_guest="price,buy"]
Set a width per column with column_widths. Use a percentage or a CSS length. The key is the column name, without a custom heading.
[yh_wc_product_table columns="image,name,sku,price,buy" column_widths="name:40%,sku:90px,price:110px"]
quantities is not a column. columns="name,quantities,buy" adds an empty column headed “Quantities”.
Fix: Keep buy in the column list and add quantities="true" as its own attribute.
The column reads one meta value on the product, using the key exactly, in lowercase.
Fix: Check the meta key in the database or with a fields plugin. Use cf:my_field, not the field label. Variation rows read the variation’s own meta, not the parent’s.
The slug does not match the attribute, or the product has no value for it.
Fix: Use the attribute slug from Products → Attributes, for example att:color. Global attributes are stored as pa_color. Leave the pa_ off in the shortcode.