Metafields tutorial

Metafields help you to customize the functionality and appearance of your Shopify store by letting you save specialized information that isn't usually captured in the Shopify admin. Metafields can be used internally in your Shopify admin and you can also choose to display them in your online store.

The following are some examples of metafields and where you can use them:

  • Create shipping instructions for products, such as information on packing material, for your product page in your Shopify admin.
  • Create estimated processing or shipping time, such as Ships in 1 day, and display it on your product pages in your online store.
  • Add color information for products, such as red, black, or blue, and display it on your product pages in your online store or use it to create automated collections by metafields.
  • Some product categories come with category metafields that include color. After you select a product category in a product, you can add in color entries for the color category metafield. You can connect color entries to your variant options. When you use color entries as variant options, you can display variant options as swatches for color options on your storefront products pages. Learn more about category metafields.

You can add metafields to your products, collections, customers, orders, and other parts of your store, directly from your Shopify admin.

If you have an Online Store 2.0 theme, then you can connect most metafields to your theme by using the theme editor. If you're using vintage themes, or if you want to add metafield types that your theme doesn't support, then you can edit your theme code or hire a Shopify Partner to help you. Learn more about hiring a Shopify Partner.

Product care instructions tutorial

In this tutorial, you learn how create a metafield for product care instructions and display them on your online store.

What you'll learn

After you've finished this tutorial, you'll have accomplished the following:

  • Created a metafield definition
  • Added values to metafields
  • Published your metafields

Step one: Create a metafield definition

  1. From your Shopify admin, go to Settings > Custom data.
  2. In the Metafields section, click Product metafields.
  3. Click Add definition.
  4. Name your metafield definition Care guide and click the standard metafield definition that is displayed. Learn more about standard metafield definitions.
  5. Click Save.

After your metafield definition has been saved, you can start adding values to metafields.

Step two: Add values to metafields

  1. From your Shopify admin, go to Products.
  2. Click a product that you want to have care instructions.
  3. In Product metafields, click Care guide. Enter the care instructions.
  4. Click Save.

Repeat the steps above to add values to your metafield in other products.

Next, you will publish your metafield to your online store.

Step three: Publishing your metafield to your online store

Now that you've added values to your metafields for your products, it's time to display your metafield on your store. This step uses the theme editor to select the blocks and sections where your metafield will be linked to.

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

Connect dymamic source icon

  1. From your Shopify admin, go to Online Store > Themes.
  2. Find the theme you want to edit, and then click Customize.
  3. Use the drop-down menu at the top of your screen to select Products > Default product. This loads the default product template in the theme editor.
  4. In the Product information section, click Add block > Collapsible row.
  5. Enter a heading.
  6. Optional: Choose an Icon from the list or click None for no icon.
  7. Next to row content, click the Connect dynamic source icon and select Care guide.
  8. Click Save to publish your product care instructions.

Your care instructions will only display on the products they're connected to and the section isn't filled in for any products without a value for that metafield. That means you can set up a single product template that'll work for all your products.

Ready to start selling with Shopify?Try it free