Anchor to metafieldDefinitionTypesmetafield
metafieldDefinitionTypes
query
Each metafield definition has a type, which defines the type of information that it can store. This type is enforced across every instance of the resource that owns the metafield definition.
Refer to the list of supported metafield types.
Anchor to Possible returnsPossible returns
- Anchor to MetafieldDefinitionTypeMetafield•
Definition Type A metafield definition type provides basic foundation and validation for a metafield.
Was this section helpful?
Fetch all metafield definition types
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query MetafieldDefinitionTypes {
metafieldDefinitionTypes {
category
name
supportsDefinitionMigrations
supportedValidations {
name
type
}
}
}`,
);
const data = await response.json();
query MetafieldDefinitionTypes {
metafieldDefinitionTypes {
category
name
supportsDefinitionMigrations
supportedValidations {
name
type
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-04/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "query MetafieldDefinitionTypes { metafieldDefinitionTypes { category name supportsDefinitionMigrations supportedValidations { name type } } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query MetafieldDefinitionTypes {
metafieldDefinitionTypes {
category
name
supportsDefinitionMigrations
supportedValidations {
name
type
}
}
}`,
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `query MetafieldDefinitionTypes {
metafieldDefinitionTypes {
category
name
supportsDefinitionMigrations
supportedValidations {
name
type
}
}
}`,
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
query MetafieldDefinitionTypes {
metafieldDefinitionTypes {
category
name
supportsDefinitionMigrations
supportedValidations {
name
type
}
}
}
QUERY
response = client.query(query: query)
Response
JSON{
"metafieldDefinitionTypes": [
{
"category": "TRUE_FALSE",
"name": "boolean",
"supportsDefinitionMigrations": true,
"supportedValidations": []
},
{
"category": "COLOR",
"name": "color",
"supportsDefinitionMigrations": true,
"supportedValidations": []
},
{
"category": "DATE_TIME",
"name": "date_time",
"supportsDefinitionMigrations": true,
"supportedValidations": [
{
"name": "min",
"type": "date_time"
},
{
"name": "max",
"type": "date_time"
}
]
},
{
"category": "DATE_TIME",