Placebo 1.0.0 / Documentation

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#

  1. Several blocks have a Source setting. It starts on the content typed in the block.
  2. Switch it to the product metafield and the block reads one metafield, with a fixed name, on the product of the page.
  3. 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#

  1. In your Shopify admin, go to Settings › Custom data › Products and select Add definition.
  2. Give it a name. Set the namespace and key exactly as written on this page. For custom.facts, the key is facts. Shopify suggests the namespace custom by default.
  3. Choose the type given in the tables below, for example Single line text with List of values.
  4. Open a product, scroll to Metafields and fill the value.
  5. 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.

MetafieldTypeWritten asRead by
custom.factsList of single line text, or multi-line text with one row per lineLabel | ValueProduct label (second group), Product facts
custom.box_contentsList of single line text, or multi-line textName | QuantityProduct label (first group)
custom.ingredientsList of single line text, or multi-line textName | Amount | NoteIngredient list
custom.claimsList of single line text, or multi-line textStatement | Detail | Source | Source linkEvidence list
custom.faqList of single line text, or multi-line textQuestion | AnswerQuestion list
custom.detail_cardsList of single line text, or multi-line textTitle | Text, or Title | Line on the card | TextDetail cards, Detail card
custom.videosList of files (videos)Pick the video filesCreator videos
custom.storyRich text, or multi-line textThe textStory

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 with http or /. 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.story replaces 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#

BlockSettingChoice that reads the metafield
Product labelSource of the itemsProduct metafield (custom.box_contents)
Product labelSource of the rowsProduct metafield (custom.facts)
Product factsSource of the rowsProduct metafield (custom.facts)
Ingredient listSourceProduct metafield (custom.ingredients)
Evidence listSourceProduct metafield (custom.claims)
Question listSourceProduct metafield (custom.faq)
StorySourceProduct metafield (custom.story)
Detail cardsAdd cards from the product metafieldOn. Adds up to 6 cards after the card blocks.
Detail cardContentProduct metafield (custom.detail_cards), with Entry to show for the position of the entry
Creator videosSourceProduct 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.

MetafieldTypeUsed by
custom.short_descriptionSingle line text or multi-line textDescription block: the first sentence, when Use product metafields is on
custom.highlightsList of single line textDescription block: up to 8 highlights
custom.taglineSingle line textWords written over the first picture of the gallery
custom.media_taglinesList of single line textOne tagline per media, in media order
custom.badgesList of single line textYour own badges on cards, on the gallery and under the product heading
custom.marksList of single line textMarks block, up to 12
custom.plan_benefitsList of single line textPurchase options block: the benefits listed inside the chosen plan
custom.pairs_withList of productsOften purchased with block and the add-on of Buy buttons, when the product has no complementary products
custom.bundle_itemsList of products, or list of product variantsBundle contents block
custom.bundle_quantitiesList of integersQuantity of each bundle item, in the same order. Empty: one each
custom.siblingsList of productsSibling products block and sibling swatches on cards
custom.sibling_labelSingle line textWhat this product is called inside its group, such as Red
custom.sibling_colorColorThe swatch of this product inside its group
custom.sibling_swatchFile (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:

  1. Sold out or sale. These are automatic. On the product page they are written beside the price.
  2. New, for the number of days set in Show New for under Theme settings > Product badges.
  3. The values of custom.badges.
  4. Product tags that start with the Tag prefix. With the default prefix, the tag badge: Vegan shows 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.

  1. Create the product metafield custom.siblings with the type Product, List of products.
  2. On each product of the group, fill it with every product of the group, itself included, in the same order.
  3. Add the Sibling products block to the product template.
  4. 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.rating and reviews.rating_count metafields 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.

MetafieldFields read from each entry
custom.factslabel, value, note
custom.box_contentsname, quantity, note, image, icon
custom.ingredientsname, amount, role, origin, image
custom.claimsstatement, figure, unit, detail, source_label, source_url
custom.faqquestion, answer
custom.detail_cardstitle, subtitle, icon, image, body
custom.videosvideo, poster, creator, label, caption, product
custom.badges, custom.markslabel, tone, tooltip
custom.quotesquote, author, detail, for the Selected quotes block

The theme has no page template for entries. Entries are shown inside the blocks above only.

Still stuck? We answer within two business days, Monday to Friday.

Contact support