Hello,
We are unable to delete inventory items for our location using the DELETE /admin/api/2023-04/inventory_levels.json request and hope you can help us. This issue is causing problems for our customer as he cannot change/remove this stock from Shopify UI and we cannot remove location using API. This is causing orders to keep routing to our app.
This is the workflow we follow:
Initially, we read the variant information with the GET /admin/api/2023-04/variants/XXXX.json request and got the response
{
"variant": {
"id": 44029453566107,
"product_id": 7844825727131,
"title": "Default Title",
"price": "25.00",
"sku": "00196177244849",
"position": 1,
"inventory_policy": "deny",
"compare_at_price": null,
"fulfillment_service": "manual",
"inventory_management": "shopify",
"option1": "Default Title",
"option2": null,
"option3": null,
"created_at": "2024-01-22T11:28:02+00:00",
"updated_at": "2024-03-20T20:29:20+00:00",
"taxable": true,
"barcode": "00196177244849",
"grams": 300,
"weight": 300,
"weight_unit": "g",
"inventory_item_id": 46124326355099,
"inventory_quantity": 1016,
"old_inventory_quantity": 1016,
"tax_code": "P0000000",
"requires_shipping": true,
"admin_graphql_api_id": "gid://shopify/ProductVariant/44029453566107",
"image_id": null
}
}
Then we use inventory_item_id together with our location_id in the DELETE /admin/api/2023-04/inventory_levels.json request to delete the stock in our location.
The issue is that the delete request fails with status code 422 and we don’t know the reason.
We also confirmed that the inventory exists in this location with the GET /admin/api/2023-04/inventory_levels.json request.
So the inventory item exists in our location but we are not able to remove it.
What could be the reason for not being able to delete this inventory item from our location?
Thanks in advance