Custom data
Placebo works with none of the data on this page. Every block has content you type in the theme editor, and that is what a new store shows. Product metafields are for stores that want some of that content to change per product without building a template for each one.
How it works#
- Several blocks have a Source setting. It starts on the content typed in the block.
- Switch it to the product metafield and the block reads one metafield, with a fixed name, on the product of the page.
- A product that does not have the metafield keeps showing the content typed in the block. Nothing breaks and nothing is left empty.
The theme creates no metafield definition and needs none. You create only the ones you want.
Create a product metafield#
- In your Shopify admin, go to Settings › Custom data › Products and select Add definition.
- Give it a name. Set the namespace and key exactly as written on this page. For
custom.facts, the key isfacts. Shopify suggests the namespacecustomby default. - Choose the type given in the tables below, for example Single line text with List of values.
- Open a product, scroll to Metafields and fill the value.
- In the theme editor, open the block and set its Source to the product metafield.
Metafields read through a Source setting#
All are product metafields in the namespace custom. The simple types need nothing else.
| Metafield | Type | Written as | Read by |
|---|---|---|---|
custom.facts | List of single line text, or multi-line text with one row per line | Label | Value | Product label (second group), Product facts |
custom.box_contents | List of single line text, or multi-line text | Name | Quantity | Product label (first group) |
custom.ingredients | List of single line text, or multi-line text | Name | Amount | Note | Ingredient list |
custom.claims | List of single line text, or multi-line text | Statement | Detail | Source | Source link | Evidence list |
custom.faq | List of single line text, or multi-line text | Question | Answer | Question list |
custom.detail_cards | List of single line text, or multi-line text | Title | Text, or Title | Line on the card | Text | Detail cards, Detail card |
custom.videos | List of files (videos) | Pick the video files | Creator videos |
custom.story | Rich text, or multi-line text | The text | Story |
How to write the lines:
- The vertical bar separates the parts. Spaces around it do not matter.
- Only the first part is required. In
custom.claims, everything after the statement is optional. - In
custom.faq, everything after the first bar is the answer, so an answer can contain a bar. - In
custom.claims, the source link is used only when it starts withhttpor/. A claim without a source is shown without one. The theme never writes a source you did not give. - A line that cannot be read, such as a row without a label, is skipped.
- For
custom.videos, the alt text of each file becomes the caption in the player. Files that are not videos are skipped. custom.storyreplaces the text of the Story block. The heading, label and image stay the ones typed in the block.
The setting to change in each block#
| Block | Setting | Choice that reads the metafield |
|---|---|---|
| Product label | Source of the items | Product metafield (custom.box_contents) |
| Product label | Source of the rows | Product metafield (custom.facts) |
| Product facts | Source of the rows | Product metafield (custom.facts) |
| Ingredient list | Source | Product metafield (custom.ingredients) |
| Evidence list | Source | Product metafield (custom.claims) |
| Question list | Source | Product metafield (custom.faq) |
| Story | Source | Product metafield (custom.story) |
| Detail cards | Add cards from the product metafield | On. Adds up to 6 cards after the card blocks. |
| Detail card | Content | Product metafield (custom.detail_cards), with Entry to show for the position of the entry |
| Creator videos | Source | Product metafield (custom.videos) |
The product of the page is the product of the product page, or the product chosen in the section that holds the block, such as Featured product. On a page with no product, the block shows its typed content.
Metafields read without a setting#
These are read directly when a product has them. All are optional.
| Metafield | Type | Used by |
|---|---|---|
custom.short_description | Single line text or multi-line text | Description block: the first sentence, when Use product metafields is on |
custom.highlights | List of single line text | Description block: up to 8 highlights |
custom.tagline | Single line text | Words written over the first picture of the gallery |
custom.media_taglines | List of single line text | One tagline per media, in media order |
custom.badges | List of single line text | Your own badges on cards, on the gallery and under the product heading |
custom.marks | List of single line text | Marks block, up to 12 |
custom.plan_benefits | List of single line text | Purchase options block: the benefits listed inside the chosen plan |
custom.pairs_with | List of products | Often purchased with block and the add-on of Buy buttons, when the product has no complementary products |
custom.bundle_items | List of products, or list of product variants | Bundle contents block |
custom.bundle_quantities | List of integers | Quantity of each bundle item, in the same order. Empty: one each |
custom.siblings | List of products | Sibling products block and sibling swatches on cards |
custom.sibling_label | Single line text | What this product is called inside its group, such as Red |
custom.sibling_color | Color | The swatch of this product inside its group |
custom.sibling_swatch | File (image) | The swatch as a picture. It is used before the color |
Badges#
Badges are shown on product cards, on the first picture of the product gallery and under the product heading. They appear in this order:
- Sold out or sale. These are automatic. On the product page they are written beside the price.
- New, for the number of days set in Show New for under Theme settings > Product badges.
- The values of
custom.badges. - Product tags that start with the Tag prefix. With the default prefix, the tag
badge: Veganshows the badge Vegan.
A card shows at most the number set in Maximum badges on a product card. The product page shows at most four. Tags are the fastest way to start: they need no metafield definition.
The theme has no low stock badge, no countdown badge and no selling fast badge.
Sibling products#
Use sibling products when a color or a flavor is sold as its own product, and you want the products to read as one option.
- Create the product metafield
custom.siblingswith the type Product, List of products. - On each product of the group, fill it with every product of the group, itself included, in the same order.
- Add the Sibling products block to the product template.
- For swatches on product cards, turn on Show sibling products as swatches under Theme settings > Product cards.
The swatch of each sibling is taken, in order, from custom.sibling_swatch, from custom.sibling_color, from the color data Shopify holds for the product, then from the product's picture. Its label is custom.sibling_label, or the product title when that is empty. Each sibling is a normal link to its product page.
Conventions in media alt text#
Two small conventions let one product's media carry more information. Write the alt text as usual, then add:
- A vertical bar and a few words for a tagline written over that picture:
Black box of sticks | Nothing else, ever. - A hash and an option value at the very end, to show the media only for that value:
Front view #red. This applies when Show media for the selected variant only is set to Group by a mark in the alt text.
Both additions are removed from the alt text that screen readers announce. See Media for the selected variant only.
Data Shopify already holds#
The theme also reads standard Shopify data. There is nothing to create for these.
- Option swatches: the colors and images you set on product options.
- Product ratings: the standard
reviews.ratingandreviews.rating_countmetafields that review apps keep up to date. - Composition and care instructions from Shopify's category metafields, in the gallery panel.
- Complementary products from the Shopify Search and Discovery app.
- Selling plans, inventory, quantity rules and volume pricing.
Connect a dynamic source#
Wherever the theme editor shows the dynamic source icon beside a setting, you can connect that setting to a standard field or to a metafield of your own, whatever its name. Typed rows are multi-line text settings, so a multi-line text metafield can be connected to them. This is a Shopify feature and works with every text, rich text, image and video setting.
Advanced: richer entries#
This is optional and most stores do not need it. If you already keep content as metaobject entries, or want richer rows such as a picture beside an item, the metafields in the first table can be a list of metaobject references in place of a list of text. The theme does not create or require any definition and has no setting for one. It only reads these fields when it finds them, and a missing field is not drawn.
| Metafield | Fields read from each entry |
|---|---|
custom.facts | label, value, note |
custom.box_contents | name, quantity, note, image, icon |
custom.ingredients | name, amount, role, origin, image |
custom.claims | statement, figure, unit, detail, source_label, source_url |
custom.faq | question, answer |
custom.detail_cards | title, subtitle, icon, image, body |
custom.videos | video, poster, creator, label, caption, product |
custom.badges, custom.marks | label, tone, tooltip |
custom.quotes | quote, author, detail, for the Selected quotes block |
The theme has no page template for entries. Entries are shown inside the blocks above only.