Metafields enable 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. You can use metafields for internal tracking, or to display specialized 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, while a grocery store might want to display a product expiration date for canned goods. Other examples of specialized information include the following:
- part numbers
- color swatches
- launch dates
- related products
- blog post summaries
- files for download
- lists of ingredients
You can add metafields to your products, collections, customers, orders, and other parts of your store, either 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.
Setting up new metafields involves the following tasks:
- Adding metafield definitions to add fields for your specialized information to pages in your Shopify admin
- Adding metafield values to parts of your store, such as products or variants
- Optional: Connecting metafields to your theme to display specialized information on your online store
You can also migrate existing metafields to a definition. Adding definitions for sets of metafields enforces validation rules to ensure that your metafield values are consistent and reliable. If your metafield values don't match the validation rules for your definition, then you can fix invalid metafield values after migration.