Migrate metafields
In the 2021-07
API version release, the value_type
field on the Metafield
object was deprecated. As of the 2022-01
API version release, the value_type
field has been removed from these APIs.
In the GraphQL Admin API, the type
field replaces the valueType
field in the Metafield
object.
This guide describes how you can migrate your metafields from using value_type
to type
in the GraphQL Admin API.
How it works
Anchor link to section titled "How it works"For backward compatibility, when metafields that use the new types are queried from API version 2021-04
or earlier, we return a backward-mapped value type. For example, the date
type maps to the STRING
value type.
The new type
attribute also accepts deprecated value types. You can update the field name and keep the same value to avoid breaking other integrations (such as Liquid in themes). However, when adding new metafields, we recommend using the new types.
Example of migrating metafields
Anchor link to section titled "Example of migrating metafields"Change the valueType
field to type
in your Metafield
object, as shown in the following example:
To learn more about using Shopify APIs to work with metafields, refer to the following documentation: