Hello,
I’m working hard to upgrade to version 2024-07 (the same with 2024-10).
I would create a variant with the following request. The response is successful but contains not the created variantId and also not the productId.
Nevertheless in the Shopify-Backend the new variant then exists with the provided options but the price and the sku was not taken over.
I miss some error messages in the response. What I’m doing wrong here?
Request => POST: https://secret.myshopify.com/admin/api/2024-07/graphql.json
{
"query": "mutation($variants: [ProductVariantsBulkInput!]!) { productVariantsBulkCreate(productId: \"gid://shopify/Product/9605053710656\", strategy: REMOVE_STANDALONE_VARIANT, variants: $variants) { product { id } productVariants { id } } }",
"variables": {
"variants": [
{
"inventoryItem": {
"sku": "13791161",
"tracked": true
},
"price": 3332.5,
"compareAtPrice": 3749.1667,
"optionValues": [
{
"id": "gid://shopify/ProductOptionValue/4066001224000"
},
{
"id": "gid://shopify/ProductOptionValue/4066001256768"
}
]
}
]
}
}
Response => OK
{
"data": {
"productVariantsBulkCreate": {
"product": null,
"productVariants": []
}
},
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 2000.0,
"currentlyAvailable": 1990,
"restoreRate": 100.0
}
}
}
}
For more information. Here is the request of the product (with its default variant) before I did the request above.
Request => POST: https://secret.myshopify.com/admin/api/2024-07/graphql.json
{
"query": "query { productVariants(first: 1, query: \"product_id:9605053710656\") { edges { node { id sku inventoryItem { id sku } selectedOptions { name value } product { id options { id name position optionValues { id name hasVariants } } } } } } }"
}
Response => OK
{
"data": {
"productVariants": {
"edges": [
{
"node": {
"id": "gid://shopify/ProductVariant/49749142110528",
"sku": "",
"inventoryItem": {
"id": "gid://shopify/InventoryItem/51404363333952",
"sku": ""
},
"selectedOptions": [
{
"name": "Groesse",
"value": "50cm"
},
{
"name": "Farbe",
"value": "-"
}
],
"product": {
"id": "gid://shopify/Product/9605053710656",
"options": [
{
"id": "gid://shopify/ProductOption/12015969239360",
"name": "Groesse",
"position": 2,
"optionValues": [
{
"id": "gid://shopify/ProductOptionValue/4066001224000",
"name": "50cm",
"hasVariants": true
}
]
},
{
"id": "gid://shopify/ProductOption/12015969272128",
"name": "Farbe",
"position": 3,
"optionValues": [
{
"id": "gid://shopify/ProductOptionValue/4066001256768",
"name": "-",
"hasVariants": true
}
]
}
]
}
}
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 8,
"actualQueryCost": 8,
"throttleStatus": {
"maximumAvailable": 2000.0,
"currentlyAvailable": 1992,
"restoreRate": 100.0
}
}
}
}
Thank you advance.
Best regards
Florian
