Details table
Add product nutrition values and related subrows using Shopify metafields.
Spread is in development. These early guides grow as the theme does.
The Details table shows product information as labelled rows, with optional indented subrows. Each product has its own values, so the same block can show different information on different products.
You choose which rows to include. The nutrition fields below are a worked example, not a required list to copy.
How it works
The table reads product metafields: extra fields where you save information about a product. There are three parts to the setup:
- Create a definition once in Shopify admin for each row you need. This makes the field available when you edit products.
- Enter a value on each product where you want that row to appear.
- Add the Details table block in the theme editor. It finds the supported fields automatically; you do not connect each row separately.
A metafield's namespace and key tell the block where a row belongs and what to call it. For example, in nutritional.fat, nutritional is the namespace and fat is the key.
| Part | What it controls |
|---|---|
| Namespace | Whether the field is a main row or a subrow of a particular main row. |
| Key | The label customers see. Underscores become spaces and the label uses sentence case: total_fat becomes Total fat. |
| Admin Name | The name you use to find the field in Shopify admin. Changing it does not change the storefront label. |
| Product value | The text shown beside the label, including any units you enter. The block does not calculate or convert values. |
You do not need JSON, nested theme blocks, an app or individual dynamic-source connections.
Plan your rows
Choose the information you want to show before creating your definitions. Every field must use One → Single line text (single_line_text_field). Numbers, lists, rich text, JSON and other types are skipped.
Main rows
Use nutritional as the namespace and choose a key that describes the row. For example, nutritional.protein creates a main row labelled Protein. The namespace is required; protein is your choice of key.
Optional subrows
A subrow sits immediately below its main row with an indent. Its namespace must be nutritional_sub_ followed by the entire main row's key. Choose a separate key for the subrow's label.
For example, a main row at nutritional.total_fat needs its subrows in nutritional_sub_total_fat. A subrow at nutritional_sub_total_fat.of_which_saturated would be labelled Of which saturated. Subrows are one level deep and cannot appear without a populated main row.
Order and limits
Main rows appear alphabetically by key. Each main row's subrows follow it, also alphabetically by key. Pinning or rearranging definitions in Shopify admin does not set the storefront order. Do not use double underscores, number prefixes or unrelated namespaces to arrange rows.
The block has no prescribed nutrition ordering controls. If you need a particular regulated label order or layout, this block may not meet that requirement; it does not establish nutritional or labelling compliance.
Keep each namespace to at most 50 fields, including blank or unsupported fields. This applies to the main namespace and separately to each subrow namespace. Larger namespaces are outside this block's supported setup and may omit rows; the table does not paginate them. See Shopify's loop documentation.
Worked example: nutrition rows
This example creates Fat and Carbohydrate as main rows, each with one subrow. Follow it to learn the setup, or use your own planned rows with the namespace patterns above. You can add further rows in the same way.
1. Create the definitions
In Shopify admin, go to Settings → Metafields and metaobjects → Products → Add definition. Each row below is a separate definition. If you are following this example, use its Namespace and key exactly and choose One → Single line text. Leave category assignments empty to make the fields available to all products.
| Admin Name | Namespace and key | Type | Example product value |
|---|---|---|---|
| Fat | nutritional.fat | Single line text | 14 g |
| Saturates | nutritional_sub_fat.of_which_saturated | Single line text | 3.2 g |
| Carbohydrate | nutritional.carbohydrate | Single line text | 48 g |
| Sugars | nutritional_sub_carbohydrate.of_which_sugars | Single line text | 7.5 g |
These values are examples for setup, not nutrition information for your products. Enter your own verified values, including their units.
Create the Fat definition
Enter Fat as the Name. Click the namespace and key shown below it, replace Shopify's suggested custom.fat with nutritional.fat, then select One → Single line text and save. Pinning the definition makes it easier to find while editing a product; it does not change the storefront order.
The Admin Name helps you find the field in Shopify. The storefront label comes from the key: fat becomes Fat. Changing only the Admin Name does not change that label.
Create its Saturates subrow
Add another definition. Enter Saturates as its Name and nutritional_sub_fat.of_which_saturated as its Namespace and key. Choose One → Single line text and save.
The namespace links this row to Fat. The key of_which_saturated supplies the visible label Of which saturated. Repeat the same steps for Carbohydrate and Sugars using the table above.
2. Enter values on a product
Open Products, select a product, and find its Metafields near the bottom of the page. Open View all if your definitions are not shown. Enter values for Fat, Saturates, Carbohydrate and Sugars, then save the product.
- Include units in the text, for example
14 g,<0.1 gor1,760 kJ / 420 kcal. The theme shows the value you entered; it does not calculate or convert it. 0and0 gare real values and remain visible. A blank value hides that row.- A blank or missing parent also hides all of its subrows. A subrow cannot appear on its own.
3. Add the block in the theme editor
Open your Spread theme editor and choose the product template you want to edit. In the product information section, select Add block → Details table. Drag the block to its position, optionally edit Heading, Heading tag and Caption, and save. Desktop spacing → Bottom and Mobile spacing → Bottom control the following gap independently; zero removes that gap.
On a Featured product section, add the same block and select the product in that section. The table uses the selected product's values. Quick view uses the blocks from that product's product template, so add the block there to include it in quick view.
If the current product has no supported, populated parent rows, the editor shows a setup notice with this guide's link. Customers and ordinary theme previews see nothing for the empty block: no table, heading or leftover gap. The notice is only visible while editing.
Changing rows and languages
To add another row later, create a single line text definition using the patterns in Plan your rows, then enter values on your products. The block discovers it automatically.
Changing a main row's key requires updating its subrows' namespace and moving the product values to the new definitions. Save and test on an unpublished theme first; changing only the Admin Name does not reconnect fields or change the visible label.
Key-derived labels are shared across languages and are not translated by Translate & Adapt. The block's heading and caption are separate editable theme text. Product values are displayed as Shopify supplies them for the current storefront context; the block adds no translation or localisation of units.
Check your setup
- Preview a product with your main rows and subrows populated. In the worked example, Of which saturated should sit below Fat with an indent, and Of which sugars below Carbohydrate. Carbohydrate appears before Fat because the main rows are sorted alphabetically by key.
- Clear a main row's value and save. That row and its subrows should disappear. Enter
0 gand save; they should return if the subrows still have values. - Preview another product. It should show its own values, or no table if none are set. Check the product page, Featured product and quick view separately.
- Check a narrow phone preview and long values. Labels and values should wrap inside the table.
If a row is missing, check the product, exact namespace and key, One → Single line text type and saved value first. custom.fat and nutrition.fat are different fields and will not be read. For a missing subrow, check its parent's value and the full parent key in the child namespace. The theme does not create definitions or populate product values for you.




