A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Dear Experts,
When I am sending GraphQL Mutation command as following JSON format it is shown following error, but when sending Query and Variable separately it is working good. Could you pls help what's wrong in the JSON format.
Variable $input of type ProductVariantInput! was provided invalid value
Payload as JSON:
{
"query":"mutation($input:ProductVariantInput!){productVariantUpdate(input:$input){productVariant{id sku inventoryItem {id sku}}}}"
,"variables":{
"id":"gid://shopify/ProductVariant/123456"
,"sku": null
}
}
The following Command executed successfully:
Query:
mutation ($input: ProductVariantInput!) {
productVariantUpdate(input: $input) {
productVariant {
id
sku
inventoryItem {
id
sku
}
}
}
}
Variable:
{
"input": {
"id": "gid://shopify/ProductVariant/123456",
"sku": null
}
}
Thank You,
Kamal Hossain
Solved! Go to the solution
This is an accepted solution.
I resolved it by adding Input object...it was missing in the variable
{
"query":"mutation($input: ProductVariantInput!){productVariantUpdate(input: $input){productVariant{id sku inventoryItem {id sku}}}}"
,"variables":{"input":{
"id":"gid://shopify/ProductVariant/32150580527153"
,"sku": null
}
}
}
Thank you.
This is an accepted solution.
I resolved it by adding Input object...it was missing in the variable
{
"query":"mutation($input: ProductVariantInput!){productVariantUpdate(input: $input){productVariant{id sku inventoryItem {id sku}}}}"
,"variables":{"input":{
"id":"gid://shopify/ProductVariant/32150580527153"
,"sku": null
}
}
}
Thank you.