Using metafields

Metafields帮助你定制功能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. Here 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 asShips 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 createautomatic collections by 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 anOnline 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 canedit your theme codeor hire a Shopify Expert to help you. Learn more about hiringShopify Experts.

Product care instructions tutorial

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

你将学习

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 toSettings>Custom data.
  2. UnderMetafields, clickProducts.
  3. ClickAdd definition.
  4. Name your metafield definitionCare guideand click the standard metafield definition that is displayed. Learn more aboutstandard metafield definitions.
  5. UnderAccess options, checkStorefront. This allows the content you create to be accessed and displayed by your online store.
  6. ClickSave.

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

Step two: Add values to metafields

  1. From your Shopify admin, go toProducts.
  2. Click a product that you want to have care instructions.
  3. InMetafields, clickCare guide. Enter the care instructions.
  4. ClickSave.

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

Next, you willpublish 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 metafields by clicking the connect dynamic source icon:

Connect dymamic source icon

  1. From your Shopify admin, go to欧宝体育官网入口首页>Themes.
  2. Find the theme you want to edit, and then clickCustomize.
  3. Use the drop-down menu at the top of your screen to selectProducts>Default product. This loads the default product template in the theme editor.
  4. In theProduct informationsection, clickAdd block>Collapsible row.
  5. Enter a heading.
  6. Optional: Choose anIconfrom the list or clickNonefor no icon.
  7. Next torow content, click theConnect dynamic sourceicon and selectCare guide.
  8. ClickSaveto publish your product care instructions.

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

Ready to start selling with Shopify?

Try it free