Hi there
I’ve been using Shopify GraphQL Admin API (Version 2021/07) for my currently-developed app. I found a bug in your updated metafield apis.
It says here in the document that Metafield object now has type field, which used to be named valueType and MetafieldInput object has the same field as Metafield object. But when I try to update customer’s metafield, it gives me an error saying "message": "Value type is not included in the list". The actual query and response are below.
PS. sorry for not using code snippets, it gave me an error saying contains invalid html so remove it
--- Mutation ---
mutation ($input: CustomerInput!) {
customerUpdate(input: $input) {
customer {
id
email
metafields(first: 10) {
edges {
node {
id
namespace
key
value
type
createdAt
updatedAt
}
}
}
}
userErrors {
field
message
}
}
}
--- Input ---
{
"input": {
"id": "gid://shopify/Customer/nnnn",
"metafields": [
{
"namespace": "vip",
"key": "points_approved",
"value": "10000",
"type": "INTEGER"
}
]
}
}
--- Response ---
{
"data": {
"customerUpdate": {
"customer": {
"id": "gid:\/\/shopify\/Customer\/nnnn",
"email": "---@gmail.com",
"metafields": {
"edges": []
}
},
"userErrors": [
{
"field": [
"metafields",
"2",
"valueType"
],
"message": "Value type is not included in the list"
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 22,
"actualQueryCost": 14,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 986,
"restoreRate": 50.0
}
}
}
}
But if you change the field type to valueType, which was previously used, in MetafieldInput like below, it goes successfully. It should have been solved before the release of version 2021/07 but now is in production.
{
"input": {
"id": "gid://shopify/Customer/nnnn",
"metafields": [
{
"namespace": "vip",
"key": "points_approved",
"value": "10000",
"valueType": "INTEGER"
}
]
}
}
Related documentations
https://shopify.dev/api/admin/graphql/reference/metafields/metafield
https://shopify.dev/api/admin/graphql/reference/metafields/metafieldinput