A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
We can choose single/multiple values values in a single metafield when add a metafield definition.
I'd like to get whether the metafield allows multiple values or not by GraphQL MetafieldDefinition API.
I tried query like this
query {
metafieldDefinitions(first: 10, ownerType: ORDER) {
edges {
node {
id
key
namespace
name
metafieldsCount
type {
category
}
}
}
}
}
and the response was
"node": {
"id": "gid://shopify/MetafieldDefinition/786366676",
"key": "_int_array",
"namespace": "custom",
"name": "整数のリスト",
"metafieldsCount": 1,
"type": {
"category": "NUMBER"
}
}
},
How can I get any information of it's single or multiplue?
Solved! Go to the solution
This is an accepted solution.
Hello @ttpp 👋
Your best bet is to query the name of the type and check that it starts with "list."
query Definition {
metafieldDefinitions(first: 10, ownerType: ORDER) {
edges {
node {
type {
name
}
}
}
}
}
This prefix is consistently used for all types that support a list of values.
To learn more visit the Shopify Help Center or the Community Blog.
This is an accepted solution.
Hello @ttpp 👋
Your best bet is to query the name of the type and check that it starts with "list."
query Definition {
metafieldDefinitions(first: 10, ownerType: ORDER) {
edges {
node {
type {
name
}
}
}
}
}
This prefix is consistently used for all types that support a list of values.
To learn more visit the Shopify Help Center or the Community Blog.
This problem was resolved thanks to your support!