All things Shopify and commerce
Hi there!,
I'm trying to create new products and variants using GraphQl. I've tried different approaches using the examples given by the Shopify docs but I received an error as output. These are the examples we've used and the error. Any ideas ?
What we are trying to do is create a product and all its variants. Is it possible ?
Thank you in advance
mutation productVariantsBulkCreate($productId: ID!, $variants: [ProductVariantsBulkInput!]!) { productVariantsBulkCreate(productId: $productId, variants: $variants) { userErrors { field message } product { id options { id name values position optionValues { id name hasVariants } } } productVariants { id title selectedOptions { name value } } } }
{ "productId": "gid://shopify/Product/8332936610007", "variants": [ { "optionValues": [ { "name": "Red", "optionName": "Color" }, { "name": "Brand new style", "optionName": "Brand and Style" }, { "name": "Silk", "optionName": "Material" } ], "price": 22 } ] }
{ "errors": [ { "message": "The option doesn't exist", "locations": [ { "line": 2, "column": 3 } ], "path": [ "productVariantsBulkCreate" ] } ], "data": { "productVariantsBulkCreate": null }, "extensions": { "cost": { "requestedQueryCost": 13, "actualQueryCost": 10, "throttleStatus": { "maximumAvailable": 2000, "currentlyAvailable": 1924, "restoreRate": 100 } } }
We're following the examples in this part of the docs:
Hi Omar Hernandez,
I have the same problem with version 2024-04.. any solution?
even adding: "strategy": "REMOVE_STANDALONE_VARIANT"
Thank's
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024