Conversations about creating, managing, and using metafields to store and retrieve custom data for apps and themes.
Version: 2019-10
I got an error while trying to add privateMetafields to product's variants, here is what I got:
Internal error. Looks like something went wrong on our end.\nRequest ID: 895cdbd0-0980-40e7-846f-df85d8c4776f (include this in support requests)."
Thank you!
Solved! Go to the solution
This is an accepted solution.
Hey @Techbity
From my search through our Shopify platform logs, it appears that this was your GraphQL Mutation:
mutation { productCreate(input: {title: "Redacted", options: ["color", "size"], images: [{src: "Redacted"}], variants: [{imageSrc: "Redacted", privateMetafields: {key: "external_usItemId", namespace: "external", valueInput: {value: "RedactedId", valueType: "STRING"}}, barcode: "", compareAtPrice: 15, price: 12, sku: "", options: ["pink", "1"]}]}) { product { id images(first: 1) { edges { cursor node { transformedSrc altText } } } } } }
The issue here is that within this mutation for productCreate, you were also attempting to create privateMetafields for a brand new Product Variant. If you would like to create privateMetafields for a Product Variant, it would need to be done in a separate mutation outside of productCreate. For example, you could first use the productCreate mutation to create the brand new Product and Product Variant, and then after use the productVariantUpdate mutation to create the privateMetafields onto the Product Variant. Alternatively you can use the productCreate variant to create the Product first, and then after use the productVariantCreate mutation to create the new Product Variant and its privateMetafields.
To learn more visit the Shopify Help Center or the Community Blog.
This is an accepted solution.
Hey @Techbity
From my search through our Shopify platform logs, it appears that this was your GraphQL Mutation:
mutation { productCreate(input: {title: "Redacted", options: ["color", "size"], images: [{src: "Redacted"}], variants: [{imageSrc: "Redacted", privateMetafields: {key: "external_usItemId", namespace: "external", valueInput: {value: "RedactedId", valueType: "STRING"}}, barcode: "", compareAtPrice: 15, price: 12, sku: "", options: ["pink", "1"]}]}) { product { id images(first: 1) { edges { cursor node { transformedSrc altText } } } } } }
The issue here is that within this mutation for productCreate, you were also attempting to create privateMetafields for a brand new Product Variant. If you would like to create privateMetafields for a Product Variant, it would need to be done in a separate mutation outside of productCreate. For example, you could first use the productCreate mutation to create the brand new Product and Product Variant, and then after use the productVariantUpdate mutation to create the privateMetafields onto the Product Variant. Alternatively you can use the productCreate variant to create the Product first, and then after use the productVariantCreate mutation to create the new Product Variant and its privateMetafields.
To learn more visit the Shopify Help Center or the Community Blog.
I got it. Thank you.
@hassain wrote:Hey @Techbity
From my search through our Shopify platform logs, it appears that this was your GraphQL Mutation:
mutation { productCreate(input: {title: "Redacted", options: ["color", "size"], images: [{src: "Redacted"}], variants: [{imageSrc: "Redacted", privateMetafields: {key: "external_usItemId", namespace: "external", valueInput: {value: "RedactedId", valueType: "STRING"}}, barcode: "", compareAtPrice: 15, price: 12, sku: "", options: ["pink", "1"]}]}) { product { id images(first: 1) { edges { cursor node { transformedSrc altText } } } } } }The issue here is that within this mutation for productCreate, you were also attempting to create privateMetafields for a brand new Product Variant. If you would like to create privateMetafields for a Product Variant, it would need to be done in a separate mutation outside of productCreate. For example, you could first use the productCreate mutation to create the brand new Product and Product Variant, and then after use the productVariantUpdate mutation to create the privateMetafields onto the Product Variant. Alternatively you can use the productCreate variant to create the Product first, and then after use the productVariantCreate mutation to create the new Product Variant and its privateMetafields.