Hello,
I’m trying to use bulk import to create products but Shopify returns an error for each “variants” field saying:
Field ‘xxx’ doesn’t exist on type ‘ProductVariantConnection’.
Assume the jsonl file was successfully uploaded.
This is my Query part:
mutation bulkOperationRunMutation($mutation: String!, $stagedUploadPath: String!) {
bulkOperationRunMutation(mutation: $mutation, stagedUploadPath: $stagedUploadPath) {
bulkOperation { id url status } userErrors { field message }}}
This is my Variables part:
"mutation": "mutation call($input: ProductInput!) { productCreate(input: $input) {
product { title productType vendor tags options { name } variants { price weight sku options { values } } }
userErrors { message } } }",
"stagedUploadPath": "tmp/xxxxx/bulk/xxx-80f2-46ff-a5da-5aadd83/myfile.jsonl"
And this is an example jsonl file:
{ "input": { "title": "Product Title", "productType": "ANYTYPE", "vendor": "The Vendor", "tags": "dddd, eee,ggg", "options": ["Size", "Color"], "variants": [ { "price": "111", "weight": 1, "sku": "4444444", "options": ["S", "Rainbow"] }, { "price": "222", "weight": 1.3, "sku": "bbb", "options": ["S", "Blue"] }, { "price": "333", "weight": 1.3, "sku": "tttt", "options": ["M", "Pink"] } ] } }
The Response is:
{
"data": {
"bulkOperationRunMutation": {
"bulkOperation": null,
"userErrors": [
{
"message": "Invalid Bulk Mutation Field - Field 'price' doesn't exist on type 'ProductVariantConnection'"
},
{
"message": "Invalid Bulk Mutation Field - Field 'weight' doesn't exist on type 'ProductVariantConnection'"
},
{
"message": "Invalid Bulk Mutation Field - Field 'sku' doesn't exist on type 'ProductVariantConnection'"
},
{
"message": "Invalid Bulk Mutation Field - Field 'options' doesn't exist on type 'ProductVariantConnection'"
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 990,
"restoreRate": 50.0
}
}
}
}
If I don’t use the ‘variants’ part, the BulkOperation runs fine (obviously removing the ‘variants’ part in jsonl file).
What am I missing?
