Hi everyone,
I’ve encountered a problem when working with metafields via the productSet mutation.
According to the Shopify documentation, the expected behavior is:
Any list field (e.g. collections, metafields, variants) will be updated so that all included entries are either created or updated, and all existing entries not included will be deleted.
This used to work exactly as described. However, since the update mentioned in this changelog:
ProductSet and CustomerSet mutations now support upserts
the behavior for metafields seems to have changed.
Now, it’s no longer possible to update existing metafield values or delete metafields using productSet. Only adding new metafields works.
Steps to reproduce:
- I have a product with metafields.
Here’s the query I use to retrieve them:
{
product(id: "gid://shopify/Product/9852689744211") {
id
metafields(first: 250) {
nodes {
namespace
key
value
type
}
}
}
}
The response shows the following metafields:
{
"nodes": [
{
"namespace": "global",
"key": "title_tag",
"value": "RYOBI 18V ONE+™ 1 Gallon air compressork"
},
{
"namespace": "dataease",
"key": "title_tag",
"value": "test"
},
{
"namespace": "dataease2",
"key": "title_tag",
"value": "test2"
},
{
"namespace": "app--181562114049",
"key": "title_tag",
"value": "upd-meta-value"
}
]
}
- Now, I try to remove all metafields using productSet with the following mutation:
mutation productSetSynchronous($productSet: ProductSetInput!) {
productSet(input: $productSet, synchronous: true) {
product {
id
metafields(first: 250) {
nodes {
namespace
key
value
type
}
}
}
userErrors {
code
field
message
}
}
}
With these variables:
{
"productSet": {
"id": "gid://shopify/Product/9852689744211",
"metafields": []
}
}
The response:
{
"productSet": {
"product": {
"metafields": {
"nodes": [
{
"namespace": "global",
"key": "title_tag",
"value": "RYOBI 18V ONE+™ 1 Gallon air compressork"
},
{
"namespace": "dataease",
"key": "title_tag",
"value": "test"
},
{
"namespace": "dataease2",
"key": "title_tag",
"value": "test2"
},
{
"namespace": "app--181562114049",
"key": "title_tag",
"value": "upd-meta-value"
}
]
}
},
"userErrors": []
}
}
As you can see, the metafields remain unchanged.
Attempts to update existing metafields result in an error. Only adding new ones works.
Tested on API versions:
• 2025-04
• 2025-01
• 2024-10
My support request ID: x-request-id: 1f4c2f2f-2653-41c4-89bf-a8fdd47a89a0-1743956392
Has anyone else run into this issue?
Would appreciate any insight or confirmation