Hello,
I am trying to set a customer metafield that is a list.metaobject_reference type.
mutation MetafieldsSet($metafields: [MetafieldsSetInput!]!) {
metafieldsSet(metafields: $metafields) {
metafields {
key
namespace
value
}
userErrors {
field
message
code
}
}
}
Variables
{
"metafields": [
{
"key": "kids",
"namespace": "custom",
"ownerId": "gid://shopify/Customer/8643416850748",
"value": "gid://shopify/Metaobject/201936896317"
}
]
}
When I set the value to the string “gid://shopify/Metaobject/201936896317”, I get the error “Value is invalid JSON: unexpected character: ‘gid://shopify/Metaobject/2019368’” which is normal since the metafield type is a list of values.
When I set it as an array or json like this
"value": [
"gid://shopify/Metaobject/201936896317"
]
I get this error: Could not coerce value [“gid:\/\/shopify\/Metaobject\/201936896314”] to String.
So when I pass a string, it wants a JSON, and when I pass a JSON, it wants a sting.
Any help would be appreciated.