Product data from metafields

On this page

Floodlit reads a few pieces of your own product data: the other kits of a shirt, the colors of a kit, a short label for a switch, a badge, and the products that go with a shirt. You create this data in the Shopify admin as product metafields, fill it in on each product, and tell the theme which metafield to read.

You do not need any of this for a basic store. Every feature on this page stays hidden or falls back to a plain default when its metafield is empty.

How the theme finds a metafield

Each metafield is named by a text setting in the theme editor. You type the namespace and the key joined by a dot, for example custom.kit_products.

  • Type it exactly as namespace.key. Do not add a product.metafields. prefix.
  • The value must have exactly two parts. A blank value, or one with more or fewer dots, turns that feature off.
  • The defaults use the custom namespace, which Shopify uses for metafields you create yourself. You can use another namespace and key: create the metafield with that name and change the setting to match.
  • Every metafield here is read on the product (not on the variant). Switch labels, kit colors and similar values are read on each product in a list, so fill them in on every product that is part of the group.

Summary

FeatureWhere you set the keyDefault keyAdmin typeRead on
Other kits of a shirtTheme settings > Personalization > Kit products metafieldcustom.kit_productsProduct, list of productsThe current product
Other editions of a shirtTheme settings > Personalization > Edition products metafieldcustom.edition_productsProduct, list of productsThe current product
Men, women and kids versionsTheme settings > Personalization > Audience products metafieldcustom.audience_productsProduct, list of productsThe current product
Label in a switchTheme settings > Personalization > Switch label metafieldcustom.switch_labelSingle line textEach product in the list
Note in a switchTheme settings > Personalization > Switch note metafieldcustom.switch_noteSingle line textEach product in the list
Kit colorTheme settings > Personalization > Kit color metafieldcustom.kit_colorColorEach kit product, and the product shown on a card
Kit trim colorTheme settings > Personalization > Kit trim color metafieldcustom.kit_trimColorEach kit product, and the product shown on a card
Back print on a cardTheme settings > Personalization > Card print metafieldcustom.card_playerSingle line text, written as NAME|9The product shown on a card
Details line on a cardTheme settings > Personalization > Card details metafieldcustom.card_metaSingle line textThe product shown on a card
Custom badgeTheme settings > Badges > Custom badge metafieldcustom.badgeSingle line text, or list of single line textThe product
Complete the kitProduct kit section > Products metafieldcustom.complete_the_kitProduct, list of productsThe current product

Create a metafield definition

You do this once per metafield. The steps are the same for every row in the table above; only the name and the type change.

  1. In the Shopify admin, open Settings > Custom data.

  2. Select Products, then Add definition.

  3. Enter a Name, for example Kit products.

  4. Check the Namespace and key line under the name. Shopify fills it in from the name; change it to the default key from the table, for example custom.kit_products, or keep your own and update the theme setting afterwards.

  5. Choose the Type from the table. For a list of products, choose Product and turn on the list option (many values). For a color, choose Color.

  6. Select Save.

To fill it in, open a product in Products, scroll to the Metafields card, and enter a value. For a list of products, select the products to add.

Products in a list must be active and available on the Online Store sales channel. A draft, archived or unpublished product does not appear.

Then check the key in the theme editor, in the setting named in the table. If you used the default keys, no change is needed.

Linked products: kits, editions and audiences

These three metafields work the same way. Each holds a list of products, and each feeds a switch on the product page.

MetafieldShown byWhat the shopper sees
Kit productsThe Kit switcher block, and the kit dots on product cardsThe home, away, third and goalkeeper kits of one shirt as links
Edition productsThe Edition switcher blockThe editions of one shirt, for example fan and authentic, with their prices
Audience productsThe audience switch of the Variant picker blockMen, women and kids versions, shown next to the size choice

How to set them up:

  1. Create the list metafield (product, list of products) for the type you need.

  2. On each product of the group, open the Metafields card and add every product of the group to the list, including the product itself. Fill in the same list on every product in the group, so each page shows the full switch.

  3. Open the product page in the theme editor and add the matching block (Kit switcher, Edition switcher) or turn on Show the audience switch in the Variant picker block.

Notes:

  • A switch needs at least two products. With fewer, it shows nothing.
  • Up to 12 products are shown in a switch.
  • The current product is marked as the selected one. The theme does not add it to the list by itself in the switch blocks, so include it. On product cards the kit dots add the current product when the list omits it, and show at most 4 dots.
  • Each block has a Fallback collection setting. When the product's list is empty, all products of that collection are used instead.
  • The same Kit products list drives the kit dots on product cards when Theme settings > Product cards > Show kit chips is on.

Switch label and switch note

Both are plain text on each product in a list.

  • Switch label is the short name shown in the kit, edition and audience switches and on the kit dots, for example Home, Away or Authentic. When a product has no label, its title is used. The Kit switcher also shows the current product's label next to its heading, for example Kit: Home.
  • Switch note is a short line shown under an option in the Edition switcher, for example Player cut, heat pressed badge. It appears in the Cards and Segmented control styles of the Edition switcher only. Kit and audience switches do not show notes.

Kit color and kit trim color

Both use the Color type and are read on each kit product.

  • Kit color is the main color of the kit. It paints the swatch dot in the kit chips on product cards. It is also the background of the back face of a card that flips to show a name and number (see Back print on a card).
  • Kit trim color is the trim of the swatch dot. On a card back, the trim color is used for the lettering when it has enough contrast with the kit color (at least 4.5 to 1). Otherwise the theme picks a light or a dark ink automatically.

Without a kit color, the card back uses the theme's default look.

Back print on a card

When the card hover effect is Flip to the back (Theme settings > Product cards > Hover effect) and a product has no second photo, the card flips to show a lettering tile with a name and number. This only happens for products that have the printing option (see Name and number printing).

The text comes from, in order:

  1. The product's Card print metafield (custom.card_player). Write the name, a vertical bar, and the number: OKAFOR|9.

  2. The Theme settings > Product cards > Back print name and Back print number settings, which apply to every card. Leave them blank for no back print.

Single line text. A product with a second photo shows that photo on the back instead.

Details line on a card

When Theme settings > Product cards > Show product details line is on, each card shows one short line under the price. It reads the Card details metafield (custom.card_meta), for example Fan, Men. When the product has no value, the product type is shown instead.

Custom badge

Theme settings > Badges > Custom badge metafield (default custom.badge) reads a text badge from the product, for example New season or Authentic. Use a single line text metafield for one badge, or a list of single line text for several.

Badges are shown in this order: sold out, pre-order, sale, the custom badge, new. A product card shows up to 2 badges and the product page title block shows up to 3, so when several apply the later ones may be left out. The other badges are controlled in Theme settings > Badges: Show sale badge, Sale badge style, Show sold out badge, Show pre-order badge and Show new badge for products published in the last days (0 turns it off).

Complete the kit

The Product kit section lists shorts, socks or other items to add with the shirt. Its Products metafield setting (default custom.complete_the_kit) names a product list metafield.

  1. Create the metafield as a list of products, with the key complete_the_kit.

  2. On each shirt, add the products that should be offered.

  3. In the section settings, check Products metafield, set Number of products to show (1 to 4, default 2) and decide on Check the first item.

If the list is empty, the section uses Shopify's complementary product recommendations instead, which come from the Shopify Search & Discovery app. If both are empty, the section stays hidden on the storefront. Details are on Product page.

Troubleshooting

ProblemCheck
A switch does not appearThe list has at least two products, and the product itself is in it. The key in the theme setting matches the definition exactly.
A switch shows product titles instead of labelsThe Switch label metafield is empty on those products, or its key in Theme settings does not match.
Kit dots show without colorKit color is empty on the kit products, or its type is not Color.
A card has no back printThe product does not have the printing option, or the card hover effect is not Flip to the back, or neither the card metafield nor the Back print settings hold a value.
The custom badge does not showThe key in Theme settings > Badges does not match, or the product already shows its maximum number of badges.
A setting looks right but nothing happensThe key has a prefix such as product.metafields., or more than one dot. Use only namespace.key.