The documentation on the mutation ProductUpdate gives this example which sounds very useful:
In theory, I should be able to update a product, create metafields, and update metafield values all in the same call.
In practice, when I try to perform such an operation (updating a product and its metafield values), I get an error:
-If I included a key for the metafield: Dupplicate keys found
-If I included a metafield ID instead and just a value: Key is too short
mutation updateProductMetafields($input: ProductInput!) {
productUpdate(input: $input) {
product {
id
metafields(first: 25) {
edges {
node {
id
namespace
key
value
}
}
}
}
userErrors {
message
field
}
}
}
{
"input": {
"metafields": [
{
"id": "gid://shopify/Metafield/2337571046",
"value": "Rubber"
}
],
"id": "gid://shopify/Product/8269738410214"
}
}
"userErrors": [
{
"message": "Type can't be blank",
"field": [
"metafields",
"0",
"type"
]
},
{
"message": "Namespace can't be blank",
"field": [
"metafields",
"0",
"namespace"
]
},
{
"message": "Namespace is too short (minimum is 3 characters)",
"field": [
"metafields",
"0",
"namespace"
]
},
{
"message": "Key can't be blank",
"field": [
"metafields",
"0",
"key"
]
},
{
"message": "Key is too short (minimum is 3 characters)",
"field": [
"metafields",
"0",
"key"
]
}
]
}
I literally copy and pasted the example from the documentation, only replacing ID values. Am I doing something wrong, or is the documentation incorrect?
Thank you
