Using the GraphQL 2025-10 version to create and update a product using the productSet mutation, gives a strange error when trying to do the following.
-
Create a new product using
productSetwithinput.productOptionsusing alinkedMetafieldandinput.metafieldswith a custommetafield.mutation ProductSet { productSet( input: { title: "New product" category: "gid://shopify/TaxonomyCategory/hg-3-30" productOptions: [ { name: "Color" linkedMetafield: { namespace: "shopify" key: "color-pattern" values: [ "gid://shopify/Metaobject/123456789012" "gid://shopify/Metaobject/123456789013" ] } } ] variants: [ { optionValues: { optionName: "Color" linkedMetafieldValue: "gid://shopify/Metaobject/123456789012" } price: 10 } { optionValues: { optionName: "Color" linkedMetafieldValue: "gid://shopify/Metaobject/123456789013" } price: 15 } ] metafields: [ { namespace: "custom" key: "length" value: "{\"value\":10,\"unit\":\"cm\"}" type: "dimension" } ] } ) { userErrors { field message } product { id options { id name position values optionValues { id name hasVariants } } variants(first: 5) { nodes { id title price selectedOptions { name value } } } } } }This operation work fine and will return a new product with an ID.
-
Next, I try to update the product with the same mutation and a few updated values
mutation ProductSet { productSet( identifier: { id: "gid://shopify/Product/12345678901234" } # adding an identifier to update the existing product input: { title: "Updated product" # updating the title category: "gid://shopify/TaxonomyCategory/hg-3-30" productOptions: [ { name: "Color" linkedMetafield: { namespace: "shopify" key: "color-pattern" values: [ "gid://shopify/Metaobject/123456789012" "gid://shopify/Metaobject/123456789013" ] } } ] variants: [ { optionValues: { optionName: "Color" linkedMetafieldValue: "gid://shopify/Metaobject/123456789012" } price: 10 } { optionValues: { optionName: "Color" linkedMetafieldValue: "gid://shopify/Metaobject/123456789013" } price: 15 } ] metafields: [ { namespace: "custom" key: "length" value: "{\"value\":10,\"unit\":\"cm\"}" type: "dimension" } ] } ) { userErrors { field message } product { id options { id name position values optionValues { id name hasVariants } } variants(first: 5) { nodes { id title price selectedOptions { name value } } } } } }This will throw an error
{ "data": { "productSet": { "userErrors": [ { "field": [ "input" ], "message": "This metafield is connected to an option. To make changes, edit the option. Metafield Namespace: shopify, Metafield Key: color-pattern, Metafield Owner: Product" } ], "product": { ... } } }, "extensions": { ... } }
I’ve tried the same operations, but leaving out the input.metafields, and the API works as expected.
-
Create a new product using
productSetwithinput.productOptionsusing alinkedMetafield, but NOinput.metafields.mutation ProductSet { productSet( input: { title: "New product" category: "gid://shopify/TaxonomyCategory/hg-3-30" productOptions: [ { name: "Color" linkedMetafield: { namespace: "shopify" key: "color-pattern" values: [ "gid://shopify/Metaobject/123456789012" "gid://shopify/Metaobject/123456789013" ] } } ] variants: [ { optionValues: { optionName: "Color" linkedMetafieldValue: "gid://shopify/Metaobject/123456789012" } price: 10 } { optionValues: { optionName: "Color" linkedMetafieldValue: "gid://shopify/Metaobject/123456789013" } price: 15 } ] } ) { userErrors { field message } product { id options { id name position values optionValues { id name hasVariants } } variants(first: 5) { nodes { id title price selectedOptions { name value } } } } } } -
Update the product with the same mutation
mutation ProductSet { productSet( identifier: { id: "gid://shopify/Product/12345678901234" } # adding an identifier to update the existing product input: { title: "Updated product" # updating the title category: "gid://shopify/TaxonomyCategory/hg-3-30" productOptions: [ { name: "Color" linkedMetafield: { namespace: "shopify" key: "color-pattern" values: [ "gid://shopify/Metaobject/123456789012" "gid://shopify/Metaobject/123456789013" ] } } ] variants: [ { optionValues: { optionName: "Color" linkedMetafieldValue: "gid://shopify/Metaobject/123456789012" } price: 10 } { optionValues: { optionName: "Color" linkedMetafieldValue: "gid://shopify/Metaobject/123456789013" } price: 15 } ] } ) { userErrors { field message } product { id options { id name position values optionValues { id name hasVariants } } variants(first: 5) { nodes { id title price selectedOptions { name value } } } } } }No errors thrown, so the API works as expected for the
input.productOptionsusing alinkedMetafield, but for some reason not when we also addinput.metafields.