HeirloomHelp CenterContact support

Metafields

Metafields hold information about a product that Shopify doesn’t have a field for, such as its producer, its tasting notes or its allergens. Heirloom uses metafields in two ways:

  • It reads some of Shopify’s standard metafields on its own. Fill them in, and they show on your online store.
  • You can connect your own metafields to the settings of sections and blocks, so that one template shows each product’s own content.

Metafields that Heirloom reads

You don’t need to set anything up in the theme editor for these. Fill them in on your products in your Shopify admin, or let an app fill them in.

Metafield Type Where it shows
Category metafields, shopify.<attribute> List of category values Product attributes blocks. See Category metafields.
shopify.disclosure Disclosures Disclosures blocks, and under the product in the cart. The block shows the product’s disclosures and those of all its variants. The cart shows the product’s and the chosen variant’s.
reviews.rating Rating Rating blocks, product cards when Show rating is on in the product card settings, and the product’s information for search engines.
reviews.rating_count Integer Rating blocks and product cards, as the number of reviews. The rating shows only when this is more than 0.
descriptors.subtitle Single line text Product cards, under the product title, when Show product subtitle is on in the product card settings.

Heirloom also shows swatches for option values that are connected to category metafields. Learn more in Variants and swatches.

Heirloom doesn’t read other metaobjects directly. Disclosures and category values are metaobject entries, and Heirloom reads them through the metafields above.

Category metafields

When you give a product a category, Shopify adds the attributes for that category as category metafields. Each Attribute of the Product attributes block reads one of them:

Attribute Metafield
Dietary preferences shopify.dietary-preferences
Allergens shopify.allergen-information
Storage shopify.storage-requirements
Taste profile shopify.taste-profile
Flavor shopify.flavor
Heat level shopify.heat-level
Country shopify.country
Region shopify.region
Grape variety shopify.grape-variety
Wine sweetness shopify.wine-sweetness
Wine body shopify.wine-body
Wine style shopify.wine-style
Coffee roast shopify.coffee-roast
Caffeine content shopify.caffeine-content
Tea variety shopify.tea-variety
Honey variety shopify.honey-variety
Oil processing method shopify.oil-processing-method

Which attributes a product has depends on its category. Learn more about category metafields in Shopify’s Help Center, and about the block in Food and drink details.

Suggested metafields for food and drink

These metafields work well with Heirloom’s sections and blocks. They’re suggestions: Heirloom doesn’t look for these names, so you can use any namespace and key.

Metafield Type Connect it to
custom.producer Single line text Provenance > Producer
custom.origin Single line text Provenance > Region
custom.tasting_nose, custom.tasting_palate, custom.tasting_finish Rich text The Text of the Nose, Palate and Finish Tasting note blocks
custom.ingredients Rich text The Ingredients Collapsible row > Text
custom.nutrition Rich text The Nutrition Collapsible row > Text
custom.serving_suggestion Rich text A Text block’s Text, or Collapsible row > Text
custom.prep_time Integer Recipe facts > Prep time (minutes)
custom.pairings List of product references Pairings section > Pairing products

To show a list as tags, such as a product’s awards, connect a list of single line text metafield to Highlights > Items. Each entry shows as its own tag.

Create a metafield definition

Create the definition before you connect it in the theme editor. A setting can only connect to a metafield that has a definition.

Steps:

  1. From your Shopify admin, go to Settings > Metafields and metaobjects.
  2. Click Products.
  3. Click Add definition.
  4. Enter a Name, such as Producer. Shopify fills in the Namespace and key, such as custom.producer.
  5. Click Select type, and then select a type, such as Single line text.
  6. Click Save.

Then open a product in your Shopify admin, and enter a value in its Metafields section. Learn more about creating metafield definitions in Shopify’s Help Center.

Connect a metafield to a setting

Steps:

  1. From your Shopify admin, go to Online Store > Themes.
  2. Find Heirloom, and then click Edit theme.
  3. At the top of the theme editor, open the page selector, and then select Products and a product template.
  4. Select a product that has the metafield filled in, so that you can see the result.
  5. In the sidebar, click the block that you want to change, such as Provenance.
  6. Next to a setting, click the Connect dynamic source icon, and then select the metafield.
  7. Click Save.

The icon shows only on settings that can take a metafield, such as text, images, links, colors, products and collections. Drop-down menus can’t take one.

To remove a connection, click the connected setting, and then disconnect the metafield.

Learn more about displaying metafields on your online store in Shopify’s Help Center.