I’m using productVariantsBulkCreate to add variants to a product. I’m including the REMOVE_STANDALONE_VARIANT strategy, but it does not remove the single variant. Any ideas on what I’m doing wrong?
Relevant snippet for the product:
"variants": [
{
"id": 45861704564977,
"product_id": 8729045663985,
"title": "Default / Default",
"price": "0.00",
"position": 1,
"inventory_policy": "deny",
"compare_at_price": null,
"option1": "Default",
"option2": "Default",
"option3": null,
"created_at": "2025-01-09T14:51:03-05:00",
"updated_at": "2025-01-09T14:51:03-05:00",
"taxable": true,
"barcode": null,
"fulfillment_service": "manual",
"grams": 0,
"inventory_management": null,
"requires_shipping": true,
"sku": "",
"weight": 0,
"weight_unit": "lb",
"inventory_item_id": 47897818661105,
"inventory_quantity": 0,
"old_inventory_quantity": 0,
"admin_graphql_api_id": "gid://shopify/ProductVariant/45861704564977",
"image_id": null
}
],
"options": [
{
"id": 11009010270449,
"product_id": 8729045663985,
"name": "Size",
"position": 1,
"values": [
"Default"
]
},
{
"id": 11009010303217,
"product_id": 8729045663985,
"name": "Color",
"position": 2,
"values": [
"Default"
]
}
]
Example request to add variant and remove the single variant:
{
"query": "mutation ProductVariantsCreate($productId: ID!, $variants: [ProductVariantsBulkInput!]!) { productVariantsBulkCreate(productId: $productId, variants: $variants) { productVariants { id } userErrors { field message } } }",
"variables": {
"productId": "gid://shopify/Product/8729045663985",
"strategy": "REMOVE_STANDALONE_VARIANT",
"variants": [
{
"inventoryItem": {
"sku": "12345",
"requiresShipping": true,
"tracked": true
},
"price": 25.99,
"taxable": true,
"barcode": "1234512345",
"optionValues": [
{
"name": "REG",
"optionId": "gid://shopify/ProductOption/11009010270449"
},
{
"name": "BLU",
"optionId": "gid://shopify/ProductOption/11009010303217"
}
]
}
]
}
}