🎉   New theme alert!   Check out   ETHERYX
Skip to content

Metafields

Combine your OpenThinking theme with Metafields to create dynamic content. Metafields are a powerful tool to add custom data to your products, collections, and pages. By using Metafields, you can display different content depending on the currently selected product, collection, or page.

Step ① - Add a new metafield definition

  1. Go to Settings → Metafields in your Shopify admin.
  2. Click Products to open the product metafield settings.
  3. Select Add definition
  4. Save your new metafield definition.

Step ② - Fill metafield in products

  1. Go to Products in your Shopify admin.
  2. Select a product to edit.
  3. Scroll down to the Metafields section.
  4. Enter a value for the new metafield.
  5. Click Save

Step ③ - Display metafield on the product page

  1. From your Shopify admin, go to Online Store → Themes
  2. Click Edit theme, then open a product template.
  3. Select (+)Add blockText.
  4. In the top-right corner of the sidebar, select Insert dynamic source to connect the metafield.

Video tutorial available

TIP

Use the Bulk Editor to quickly update metafields for multiple products at once.

Unsupported Metafields

IMPORTANT

Not all metafield types can be displayed using standard blocks. For example, to display an image metafield, you'll need to use the Custom Liquid block and call the metafield using Liquid code.

Step ① - Add a custom liquid block

  1. From your Shopify admin, go to Online Store → Themes
  2. Click Edit theme, then open a product template.
  3. Select (+)Add blockCustom Liquid.

 

Step ② - Get Metafield values with liquid

Use Liquid code to retrieve and display metafield data.

 

Generate a text version of the metafield data:

liquid
{{ product.metafields.openthinking.instructions_wash | metafield_text }}
html
This is a single line of text.

Generate an HTML element for the metafield

liquid
{{ product.metafields.openthinking.instructions_wash | metafield_tag }}
html
<span class="metafield-single_line_text_field">
    This is a single line of text.
</span>

Announcement bar

You can show a different announcement message in the announcement bar for each market (region) using Shopify's Metaobjects and Metafields. This lets you set unique messages and URLs for each market, supporting multiple languages and regions.

NOTE

In order for this to work, you first need to have your Markets set up correctly in Shopify.

Video tutorial available

Step ① - Create a Metaobject

  1. From your Shopify admin, go to Content → Metaobjects
  2. Click Add definition
  3. Name your metaobject Announcement bar
  4. Add these fields:
    • Single line text: Name it Message (for your announcement text)
    • URL: Name it URL (for the announcement link)
  5. Click Save

Step ② - Create Metafield

  1. Go to Settings → Custom data → Metafields and metaobjects
  2. Scroll to Markets and click Add definition
  3. Name the metafield Announcement bar
  4. For Type, select Metaobject
  5. Under Reference, choose the Announcement bar metaobject you created
  6. Click Save

Step ③ - Add entries

  1. Go back to Content → Metaobjects
  2. Click your Announcement bar metaobject.
  3. Click Add entry for each message you want to display (e.g. English, French, Spanish, etc.).

    NOTE

    You need a default market (e.g. "International") as a fallback for markets that don't have a custom message.

  4. Fill in the Message and URL fields for each entry.
  5. Click Save after each entry.

Step ④ - Assign Messages to markets

  1. Go to Settings → Markets
  2. Click the market/region you want to customize.
  3. Under Metafields, find your Announcement bar metafield.
  4. Assign the appropriate metaobject entry (e.g., select the Japanese message for the Japanese market)
  5. Repeat for each market.

NOTE

You can repeat this process for as many languages or regions as you need. Each market can have its own unique announcement. You can have one metaobject entry for multiple markets, or a default market (e.g. "International") as a fallback.

Step ⑤ - Connect Metafield to theme

  1. From your Shopify admin, go to Online Store → Themes
  2. Click Edit theme next to your theme.
  3. Navigate to the Announcement bar section.
  4. Click Add message button to add a new block
  5. Click the Metafield icon (Connect dynamic source).
  6. Select Market → Announcement bar.
  7. Click Save.

Step ⑥ - Test setup

  1. In the theme editor, click the Markets dropdown.
  2. Switch to the market you added references to in the previous step.
  3. Confirm that the announcement bar displays the correct message for that market.

NOTE

In order to see each market's announcement, you need to use the "Country/region selector" to switch to the market.

e.g. for the French market, you need to select "France" in the "Country/region selector" dropdown.