I’m recieving a syntax error when trying to update a metafield created in the shopify admin on productCreate mutation. I have tried formatting the value in every way imaginable, and still recieves an error.
This is my mutation:
`mutation {
productCreate(input: {
title: "example title",
handle: "example-title",
descriptionHtml: "just an example",
productType: "my type",
tags: ["tag1,tag2"],
variants:{
price: "100",
sku: "123",
},
metafields: [
{
id: "gid://shopify/Metafield/<id>",
namespace: "custom",
key: "key_example",
type: "list.single_line_text_field",
value: "[\"test1\",\"test2\"]"
}
]
}) {
product {
id
variants(first:1){
edges{
node{
id
}
}
}
}
userErrors {
message
field
}
}
}`
And this is the error I recieve:
GraphqlQueryError: syntax error, unexpected STRING (“,”), expecting COLON at [19, 28]
Also after trying to format the value like this:
value: "['test1','test2']"
I get a response on the userErrors:
{“product”:null,“userErrors”:[{“message”:“Value is invalid JSON: unexpected token at ‘‘test1’,‘test2’]’.”,“field”:[“metafields”,“0”,“value”]}]}
Is there anyone that have met the same problem, or is a graphql expert that can help me? ![]()