I am facing this issue while using productVariantsBulkCreate mutation api . (2024-04 admin api version )
productVariantsBulkCreate Input
{
"productGid": "gid://shopify/Product/8550154928285",
"variationData": [
{
"price": 20.95,
"sku": "733739029430",
"inventoryItem": {
"tracked": true
},
"inventoryQuantities": {
"availableQuantity": 6,
"locationId": "gid://shopify/Location/76652937373"
},
"weight": 0,
"weightUnit": "POUNDS",
"optionValues": [
{
"name": "2400 GDU/g - 500mg - 60 veg capsules",
"optionName": "Variation"
}
],
"mediaId": "gid://shopify/MediaImage/30748160327837"
},
{
"price": 38.95,
"sku": "733739029478",
"inventoryItem": {
"tracked": true
},
"inventoryQuantities": {
"availableQuantity": 12,
"locationId": "gid://shopify/Location/76652937373"
},
"weight": 0,
"weightUnit": "POUNDS",
"optionValues": [
{
"name": "2400 GDU/g - 500mg - 120 veg capsules",
"optionName": "Variation"
}
],
"mediaId": "gid://shopify/MediaImage/30748160360605"
}
]
}
Failed productVariantsBulkCreate Response
{
"productGid": "gid://shopify/Product/8550154928285",
"response": {
"productVariants": [],
"userErrors": [
{
"field": [
"variants",
"0",
"mediaId"
],
"message": "Image must be for this product",
"code": "MUST_BE_FOR_THIS_PRODUCT"
},
{
"field": [
"variants",
"1",
"mediaId"
],
"message": "Image must be for this product",
"code": "MUST_BE_FOR_THIS_PRODUCT"
}
]
},
"variables": {
"productId": "gid://shopify/Product/8550154928285",
"strategy": "REMOVE_STANDALONE_VARIANT",
"variants": [
{
"price": 20.95,
"sku": "733739029430",
"inventoryItem": {
"tracked": true
},
"inventoryQuantities": {
"availableQuantity": 6,
"locationId": "gid://shopify/Location/76652937373"
},
"weight": 0,
"weightUnit": "POUNDS",
"optionValues": [
{
"name": "2400 GDU/g - 500mg - 60 veg capsules",
"optionName": "Variation"
}
],
"mediaId": "gid://shopify/MediaImage/30748160327837"
},
{
"price": 38.95,
"sku": "733739029478",
"inventoryItem": {
"tracked": true
},
"inventoryQuantities": {
"availableQuantity": 12,
"locationId": "gid://shopify/Location/76652937373"
},
"weight": 0,
"weightUnit": "POUNDS",
"optionValues": [
{
"name": "2400 GDU/g - 500mg - 120 veg capsules",
"optionName": "Variation"
}
],
"mediaId": "gid://shopify/MediaImage/30748160360605"
}
]
}
}
Just created product response
"data": {
"productCreate": {
"product": {
"id": "gid://shopify/Product/8550154928285",
"media": {
"nodes": [
{
"id": "gid://shopify/MediaImage/30748160295069",
"alt": "Now Foods Bromelain",
"mediaContentType": "IMAGE",
"mediaErrors": [],
"mediaWarnings": [],
"status": "UPLOADED",
"preview": {
"status": "Over 9 levels deep, aborting normalization"
}
},
{
"id": "gid://shopify/MediaImage/30748160327837",
"alt": "Now Foods Bromelain",
"mediaContentType": "IMAGE",
"mediaErrors": [],
"mediaWarnings": [],
"status": "UPLOADED",
"preview": {
"status": "Over 9 levels deep, aborting normalization"
}
},
{
"id": "gid://shopify/MediaImage/30748160360605",
"alt": "Now Foods Bromelain",
"mediaContentType": "IMAGE",
"mediaErrors": [],
"mediaWarnings": [],
"status": "UPLOADED",
"preview": {
"status": "Over 9 levels deep, aborting normalization"
}
}
]
}
},
"userErrors": []
}
}