Hello,
I’m having a problem with the productUpdate API in graphQL.
I’ve created a metafield to enter the location of my product. (Namespace: “custom”, key: “location”);
I’m trying to do this via the shopify-graphiql-app test console. I don’t get any errors, but nothing goes up on my product.
It’s as if the API doesn’t take my request into account.
I’m on the GraphQL 2024-04 API. Here’s my code:
mutation updateProductMetafields($input: ProductInput!) {
productUpdate(input: $input) {
product {
id
metafields(first: 10) {
edges {
node {
id
namespace
key
value
}
}
}
}
userErrors {
message
field
}
}
}
Variables :
{
"input": {
"id": "gid://shopify/Product/8865022411079",
"metafields": [
{
"id": "gid://shopify/Metafield/45831948927303",
"type": "list.single_line_text_field",
"value": "Castafiore"
}
]
}
}
The id corresponds to my desired metafield. Here’s an example, done by hand on a product and fetching the same product.
{
"node": {
"id": "gid://shopify/Metafield/45831948927303",
"namespace": "custom",
"key": "emplacement",
"value": "France"
}
}
I tested several things before asking you.
There’s no problem with productCreate but productUpdate bug.
Any ideas?