Hi,
I’m encountering an issue while trying to update a product’s metafield using the productUpdate mutation in the Shopify API. The metafield currently has a value, and I would like to set it to an empty string (‘value’: ‘’). However, when I run the mutation, the metafield does not update to reflect the empty value.
Here’s the mutation I’m using:
mutation productUpdate($input: ProductInput!) {
productUpdate(input: $input) {
product {
id
metafields(first: 15) {
edges {
node {
id
namespace
key
value
}
}
}
}
userErrors {
field
message
}
}
}
For the input, I’ve set the metafield like this:
{
"id": "gid://shopify/Product/XXXX",
"metafields": [
{
"id": "gid://shopify/Metafield/YYYY",
"namespace": "namespace",
"key": "key",
"value": ""
}
]
}
The mutation runs successfully, but the metafield doesn’t update to an empty string as intended. The metafield currently has a value, and I need to clear it. Is there a specific approach for setting a metafield’s value to an empty string?
Any help or guidance on how to achieve this would be greatly appreciated!