What Are Shopify Metafields?
Last updated
In this article
Talk to our experts- Shopify metafields
- Shopify metafields are custom fields that extend Shopify's built-in data models, such as products, customers and orders, with your own data. Each metafield pairs an identifier, made of a namespace and a key, with a value and a type, and a metafield definition makes the same validation rules apply to every value you enter.
Also called: metafields
How it works
A metafield is a key-value pair with three parts:
- Identifier: a namespace and key, such as custom.warranty_info. Namespaces organize metafields, prevent naming conflicts and establish ownership.
- Value: the data being stored.
- Type: the kind of value, such as text, a number, a date or a reference, and how it is interpreted.
Before you add values, you add a metafield definition. A definition acts as a template: it says what part of the store the metafield applies to and what values it can have. Shopify recommends a standard definition whenever one fits, because standard definitions are supported by apps, themes and other parts of the store. You create a custom definition when no standard one covers your information. You can have up to 256 metafield definitions for each type, such as products or customers.
Setting up a metafield takes three tasks: add the definition, add values to parts of the store such as products or variants, and optionally connect the metafield to your theme to show it on the online store. Staff need the matching permission, for example the View and Create and edit permissions under Products for product metafields.
Types of metafield values
- Basic types: text, numbers, dates and measurements with a unit, such as single line text, number decimal, date, dimension (inches, feet, millimeters and more), weight (ounces, pounds, grams, kilograms) and volume.
- Reference types: links to Shopify resources, such as a company reference or a file reference.
- Ownership: merchant-owned metafields can be edited by merchants and all installed apps. App-owned metafields are controlled by one app and are view only in the Shopify admin by default.
Metafields in B2B stores
In a B2B store, metafields can sit on the records that wholesale ordering runs on:
- Companies and company locations: both are listed among the resource types that can own a metafield, alongside products, variants, customers, orders and draft orders.
- Draft orders to orders: you can set metafields to carry over from draft orders to completed orders. The validation details on the draft order and order definitions must match.
- Admin filters: product metafields of supported types, including company reference and single line text, can be activated as filters on the Products page.
- Reports and automation: metafields can serve as filters and dimensions in Shopify reports, and they can trigger Shopify Flow automations.
- Tags group, search, filter and bulk edit items in the admin. They aren't displayed to customers, though you can use them to categorize products on your online store and organize search results.
- Metafields hold typed values with validation rules, and you can display them on your online store.
- Metaobjects are for standalone objects with multiple related fields. Metafields add individual custom fields to specific Shopify resources.
Example
An industrial supply distributor sells work gloves by the case. It adds a product metafield definition called Pairs per case, using the integer type, and enters 12 on its cut-resistant gloves. Connected to the theme, the value shows on the product page, so a buyer ordering 5 cases can see they will receive 5 x 12 = 60 pairs. A second metafield, a file reference, attaches the spec sheet to each product.
On Shopify
Metafield definitions are managed in the Shopify admin under Settings > Metafields and metaobjects. Themes that support dynamic sources can connect most metafields through the theme editor; vintage themes, or metafield types a theme doesn't support, require editing theme code. You can edit metafields in bulk for products, variants, collections and customers with the bulk editor.
How Uncap helps
Uncap Connect maps every object and field across Shopify and your back office into one shared model, and its field-level rules decide which system wins, every time.
Sources
Frequently asked questions
What are Shopify metafields for?
They store your own specialized information, such as care instructions, dimensions or a size chart on products, or a loyalty tier on customers. Instead of putting that information in a product description, you can display each field in its own section of your theme.
What is the difference between metafields and tags in Shopify?
Tags are labels for grouping, searching and filtering items in the admin; they aren't displayed to customers, though they can categorize products and organize search results on your online store. Metafields hold typed values with validation rules that you can display on your online store.
What are category metafields in Shopify?
Category metafields are product attributes that map to a specific product category, such as size, fabric and color for shirts. They use metaobjects and metaobject entries for their values and help make products more discoverable on your site, on marketplaces and on search engines.
Can you bulk edit metafields in Shopify?
Yes. The bulk editor lets you edit metafields for products, variants, collections and customers. On the Products page, select the products, click Edit products, then choose the metafield columns to edit.