Metafields
Metafields allow you to extend an existing platform data model, such as products, customers, and orders with your own custom data.
On this page
Why use Metafields
Consider these examples for using metafields in your store:
- If you have an apparel store and you want to add care instructions for your products, then you might add a Product metafield called Care instructions. You can then add different care instructions for one or all of your products. Learn more about adding product care instructions.
- If you have a children's toy store and you want to display recommended ages and potential hazards for your products, then you might add Product metafields called Recommended age and Potential hazards. Instead of adding this information to your product description, you can display each field in its own section of your theme, with unique values for each product.
- If you have a furniture store and you want to display detailed measurements, then you might add a Product metafield called Dimensions. Instead of including measurements in your product description, you can display width, height, and depth in a dedicated section of your theme, with unique values for each product.
- If you sell clothing and you want to display a size chart for your products, then you might add a Product metafield called Size chart. You can then display the size chart as a pop-up on your product pages. Learn more about adding a pop-up size chart.
- If you run a loyalty program and you want to track reward tiers for your customers, then you might add a Customer metafield called Loyalty tier. You can then assign a unique tier level to each customer and use it to personalize their experience in your store.
How to use Metafields
Your staff can add metafields when they have a permission assigned for the corresponding resource. For example, to add, edit, and delete metafield definitions and values for products, your staff needs the View, create and edit products permissions assigned. Learn more about staff permissions.
Learn more about using metafields by adding product care instructions.
Category metafields are product attributes that map to a specific product category. Category metafields help you add the right information to your products to make them more discoverable by visitors on your site, on marketplaces, and on search engines.
Category metafields have default entries to make it easier for you to add information to your store. 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 use metaobjects and metaobject entries for the values. For example, with the color category metafield, you can add green, red, and other color entries. Learn more about category metafields.
If you have a theme that supports dynamic sources, 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.
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.