Displaying metafields on your online store

After you add metafield definitions and assign metafield values to parts of your store, you can connect metafields to your theme to display custom information on your online store in a variety of ways. For example, a candle seller might want to display a burn time for candles on their product pages, whereas a grocery store might want to display a product expiration date for canned goods.

The following are other examples of specialized information that you can display on your online store:

  • part numbers
  • color swatches
  • product release dates
  • featured products or variants
  • product star rating
  • files for download
  • ingredient lists
  • content from your category metafields

If you need to add new custom data structures, then you can also create metaobjects and connect them to your online store. Learn more about connecting metaobjects to your online store.

Connecting metafields to your theme by using the theme editor

If your theme supports metafields, then you can choose how to display metafields on your online store by using the theme editor. To find out which metafields are available in your theme, refer to your theme's documentation or contact your theme's developer.

You can connect metafields to your theme by adding sections or blocks that support dynamic sources. For example, the Product info section can support product metafields, and a Collection section can support collection metafields.

After you add a section or block, you can search for and select a single metafield by clicking the connect dynamic source icon:

Connect dynamic source icon

If the connect dynamic source icon displays a +, then you can search for and add up to 20 metafields in a single template by clicking the icon, and then selecting one metafield at a time:

Insert dynamic source icon

For step-by-step instructions, refer to Using metafields and dynamic sources.

You can connect a list of content types to Text or Rich Text sections and blocks. Product reference lists require a custom section or a third-party theme that uses product list settings.

Editing your theme code to add metafields

If you want to edit your theme code to display metafields on your online store, then you can use Liquid to reference metafields in your page templates.

Edit your theme code only if you have coding experience. If you need help with editing your theme code, then you can hire a Shopify Partner from the Shopify Partner Directory.

Learn more about hiring a Shopify Partner.

Displaying brand assets with metafields

You can use metafields to display your brand assets on your online store. Brand assets are used as a default setting, meaning after you have brand assets added, they're automatically synced with any feature that uses the Brand API.

Shopify's Online Store 2.0 themes can use your brand assets in your theme settings. You'll need to manually connect your brand assets by opening the theme editor. Find the theme setting you want to use the brand assets on, such as the logo in your store header, and click the Connect dynamic source icon.

Picture of the image select screen for logo within theme settings with the connect dynamic source icon highlighted.

Click the brand asset that you want to use in your header to connect it to your theme.

The connect dynamic source panel with Default logo selected.

If the option to connect brand assets doesn't exist, then the app, channel, or theme might not be integrated with the Brand API.

Displaying category metafields on your theme

Most standard product categories have available category metafields. For example, if you add the product category Apparel & Accessories > Clothing > Clothing Tops > Shirts, then you can add category metafields for size, neckline, sleeve length type, top length type, age group, fabric, target gender, clothing features, and color. Category metafields have default metaobject entries that you can either use as is or customize further. For example, if the color black isn't in line with your branding, then you can rename it to graphite. Learn more about category metafields.

You can use category metafields in your online store to help your customers to find the products and information that they need faster. For example, if you use color entries as variant options, then you can display variant options as swatches on your online store products pages from your theme options.

You can also use metafields with the Shopify Search & Discovery app to create filters for your product catalog. Learn more about category metafield filters.

Can’t find the answers you’re looking for? We’re here to help.