Can anyone shed any light on an issue I am having with a productCreate mutation…
I am sending the mutation inside a query as JSON…
{"query":"mutation {productCreate(input: {descriptionHtml: \"<%[Product Description]%>\", options: [{name: \"<%[Option1Test]%>\", position: 1, values: [\"<%[Option2Test]%>\", \"<%[Option3Test]%>\"]}], giftCard: <%JSONFormat([giftCard])%>, giftCardTemplateSuffix: \"<%[Gift Card Template?]%>\", productType: \"<%[Product Type]%>\", redirectNewHandle: <%JSONFormat([Re-Direct New Handle?])%>, requiresSellingPlan: <%JSONFormat([Requires Selling Plan?])%>, seo: {description: \"<%[SEO Description]%>\", title: \"<%[SEO Title]%>\"}, status: DRAFT, tags: \"<%[TAGS List]%>\", templateSuffix: \"<%[templateSuffix]%>\", title: \"<%[MVSKU Product Title]%>\", vendor: \"<%[MYVEND]%>\"}), {userErrors {field, message} product {availablePublicationCount, createdAt, descriptionHtml, description, handle, hasOnlyDefaultVariant, hasOutOfStockVariants, id, onlineStorePreviewUrl, onlineStoreUrl, productType, publishedAt, requiresSellingPlan, status, tags, templateSuffix, title, totalInventory, totalVariants, tracksInventory, updatedAt, vendor,isGiftCard, mediaCount, options(first: 10) {id, name, position, values}, priceRange {maxVariantPrice {amount, currencyCode} minVariantPrice {amount,currencyCode}}, productType, seo{description, title}, }}} "}
This is the request processed and the Response…
Request
{≡}
POST https://d4fce6.myshopify.com/admin/api/2023-07/graphql.json HTTP/1.1
{ "query": "mutation {productCreate(input: {descriptionHtml: \"TestDescription\", options: [{name: \"Option1\", position: 1, values: [\"Option2\", \"Option3\"]}], giftCard: false, giftCardTemplateSuffix: \"\", productType: \"Tool Setter\", redirectNewHandle: true, requiresSellingPlan: false, seo: {description: \"Our world-class flagship Contact CNC Optical Tool Setter. Industrial Performance. For professional machine shops. Repeatability of 0.5µm. IP68 Rated.\", title: \"Nano500 CNC Contact Optical Tool Setter | EMG Precision\"}, status: DRAFT, tags: \"\", templateSuffix: \"\", title: \"EMG Precision Nano 2 | Ø20mm Contact Optical Tool Setter CNC Z Axis\", vendor: \"\"}), {userErrors {field, message} product {availablePublicationCount, createdAt, descriptionHtml, description, handle, hasOnlyDefaultVariant, hasOutOfStockVariants, id, onlineStorePreviewUrl, onlineStoreUrl, productType, publishedAt, requiresSellingPlan, status, tags, templateSuffix, title, totalInventory, totalVariants, tracksInventory, updatedAt, vendor,isGiftCard, mediaCount, options(first: 10) {id, name, position, values}, priceRange {maxVariantPrice {amount, currencyCode} minVariantPrice {amount,currencyCode}}, productType, seo{description, title}, }}} " }
Response
{≡}
HTTP/1.1 200 OK
{ "errors": [ { "message": "Argument 'options' on InputObject 'ProductInput' has an invalid value ([{name: \"Option1\", position: 1, values: [\"Option2\", \"Option3\"]}]). Expected type '[String!]'.", "locations": [ { "line": 1, "column": 32 } ], "path": [ "mutation", "productCreate", "input", "options" ], "extensions": { "code": "argumentLiteralsIncompatible", "typeName": "InputObject", "argumentName": "options" } } ] }
No matter what I seem to do I cannot get the mutation to work, and it is specific to the ‘Options’ part. If i remove the product options element, it works perfectly…
I hope someone has some bright idea because shopify support is neither use nor ornament.