Hi folks,
My mistake for suggesting the privateMetafieldUpsert mutation. You are correct in that it is the wrong thing to be using here. Instead, we should be using the productUpdate mutation as you originally thought, except instead of passing in the key as the identifier, we should use the actual id of the metafield itself. I have included a sample of what the mutation should look like below:
mutation productUpdate($input: ProductInput!) {
productUpdate(input: $input) {
product {
metafield(namespace: "global", key: "wish_count") {
id
namespace
key
value
}
}
userErrors {
field
message
}
}
Variables:
{
"input": {
"id": "gid://shopify/Product/8441259336",
"metafields": {
"id": "gid://shopify/Metafield/11975849934931",
"value": "550",
"valueType": "INTEGER"
}
}
}
Please let me know if this works for you.