mutation productVariantsBulkCreate($productId: ID!, $media: [CreateMediaInput!] , $strategy:ProductVariantsBulkCreateStrategy!, $variants: [ProductVariantsBulkInput!]!) {
productVariantsBulkCreate(productId: $productId, variants: $variants, media: $media, strategy:$strategy) {
product {
id
}
userErrors {
field
message
}
}
}
I used the productVariantsBulkCreate mutation to create new variant, with full of params for payload:
{
"productId": "gid://shopify/Product/9562088571168",
"media": [
{
"alt": "https://ae01.alicdn.com/kf/H24419e74b70343adace6eeac02046e040.jpg",
"mediaContentType": "IMAGE",
"originalSource": "https://ae01.alicdn.com/kf/H24419e74b70343adace6eeac02046e040.jpg"
}
],
"variants": [
{
"compareAtPrice": "77662.99",
"price": "51775.45",
"inventoryItem": {
"cost": "25887.60",
"tracked": true
},
"inventoryPolicy": "CONTINUE",
"inventoryQuantities": {
"availableQuantity": 2399,
"locationId": "gid://shopify/Location/100882448672"
},
"mediaSrc": [
"https://ae01.alicdn.com/kf/H24419e74b70343adace6eeac02046e040.jpg"
],
"optionValues": [
{
"name": "Size",
"optionName": "8 inch"
},
{
"name": "Color",
"optionName": "honeycomb Tan"
}
],
"taxable": true
}
]
}
I’ve checked some questions related with this mutation, and make sure that my payload is correct. But when running, I got the error:
"errors": [
{
"message": "Option does not exist",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"productVariantsBulkCreate"
]
}
]
What are the errors? How can I fix to create new variant success?