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. 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 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.
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 Expert to help you. Learn more about hiring Shopify 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.
- What you'll learn
- Step one: Create a metafield definition
- Step two: Add values to metafields
- Step three: Publish your metafield on your 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
- From your Shopify admin, go to Settings > Custom data.
- Under Metafields, click Products.
- Click Add definition.
- Name your metafield definition Care guide and click the standard metafield definition that is displayed. Learn more about standard metafield definitions.
- Under Access options, check Storefront. This allows the content you create to be accessed and displayed by your online store.
- Click Save.
After your metafield definition has been saved, you can start adding values to metafields.
Step two: Add values to metafields
- From your Shopify admin, go to Products.
- Click a product that you want to have care instructions.
- In Metafields, click Care guide. Enter the care instructions.
- 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 metafields by clicking the connect dynamic source icon:
- From your Shopify admin, go to Online Store > Themes.
- Find the theme you want to edit, and then click Customize.
- 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.
- In the Product information section, click Add block > Collapsible row.
- Enter a heading.
- Optional: Choose an Icon from the list or click None for no icon.
- Next to row content, click the Connect dynamic source icon and select Care guide.
- 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.