How to display Shopify metafields in a product table
Metafields are custom fields that store extra information about your Shopify products, such as the material, dimensions, care instructions or technical specifications. Our Barn2 Product Table Shopify app can display any product or variant metafield as a column in the table.
This is ideal if your customers choose products based on their specifications. For example, a store selling electrical parts could add columns for the voltage, wattage and fitting, so customers can compare products at a glance.
Creating metafields in Shopify
If you haven't used metafields before, you'll need to set them up in Shopify first:
- Go to Settings → Custom data in your Shopify admin.
- Click 'Products' (or 'Variants' if the information is different for each variant).
- Click 'Add definition', give the metafield a name and choose its type.
- Edit each product and enter the information in the new field, which appears in the 'Metafields' section of the product page.
Shopify also creates some metafields automatically. For example, when you choose a category for a product, Shopify adds category metafields such as Color, Size or Material. You can display these in the product table too.
Adding a metafield column to the table
- Go to Barn2 Product Table → Product tables and create or edit a table.
- In the Columns section, choose 'Metafield' from the dropdown underneath the list, then click 'Add column'.
- Click the new column to open its settings, and choose which metafield to display.
- Enter a 'Column name', for example "Material". Otherwise, the column uses the name of the metafield.
- Drag the column to where you want it in the table, then click 'Save'.
Repeat these steps to add as many metafield columns as you like.
If you chose to show one variant per row, then each row shows the metafield for that variant. Otherwise, the table shows the product's metafield.