Metafield-linked product options
Learn about how to link metafields to product options in the new product model.
Anchor to Why we've made these changesWhy we've made these changes
The updated Shopify product taxonomy is an open-source comprehensive, global standard for product classification. It's a universal language that empowers merchants to categorize their products. Spanning 22 essential verticals, our taxonomy encompasses categories, attributes, and values, all thoughtfully integrated within Shopify and numerous marketplaces.
By using metaobjects to model each attribute's values (as metaobject entries), we ensure reusability and shop-specific customization. To connect metaobjects to any resource in Shopify, we use metafields (of type list.metaobject_reference). Then, we introduced the ability to connect these metaobjects such that merchants can create variants for each attribute value.
Anchor to Linking product options to metafieldsLinking product options to metafields
Any metafield definition
that meets the following criteria can also be used to create variants:
-
Owner type is
Product
. -
Type is
list.metaobject_reference
. -
Validation options do not include
list.min
orlist.max
. -
Access controls are set to merchant writable.
The metaobject referenced by the metafield can be either a standard, such as
shopify--color-pattern
, or a custom metaobject with any set of fields. The only requirement is that the metaobject definition must be merchant writable.Follow these steps to create variants powered by metafield-linked product options:
Anchor to Step 1: Create metaobject entries for your attributesStep 1: Create metaobject entries for your attributes
POST https://{shop}.myshopify.com/api/{api_version}/graphql.json
Create metaobject entries that will represent your attribute values. These entries can either belong to standard definitions or custom metaobjects with the requisite access controls.
GraphQL mutation
Variables
Anchor to Step 2: Create or update products with linked optionsStep 2: Create or update products with linked options
Once you have your metaobject entries, you can create or update products using these linked options. Here's an example using the productSet
mutation: