Changing inventory quantities by product API

Topic summary

A developer reports that updating a product variant’s stock via the Shopify Product API returns HTTP 200 but does not change the inventory value. The response echoes the old variant data.

  • Endpoint used: PUT /admin/api/2021-01/products/{product_id}.json with basic auth in the URL.
  • Payload: product.id plus variants array containing the target variant.id and inventory_quantity set to 10.
  • Expected: inventory_quantity updates to 10; Actual: no update, old data returned.

Another participant states this issue has many similar, unanswered threads and urges Shopify to address it, indicating the problem persists.

Code snippet and endpoint details are central to the issue. No workarounds, alternative methods, or official responses are provided. The discussion remains unresolved with key questions unanswered (why the 200 response without an update, and what the correct method to change inventory should be).

Summarized with AI on December 24. AI used: gpt-5.

I’m a developer and I’m trying to update stock quantity for a variant. It does not update the stock quantity and the request returns status code 200 with the old variant data (without updating it).

I’m sending a PUT request to url: https://{shopify_key}:{shopify_secret}@{shopify_url}/admin/api/2021-01/products/{product_id}.json

Request body:

{
“product”: {
“id”: “{product_id}”,
“variants”: [
{
“id”: “{variant_id}”,
“inventory_quantity”: 10
}
]
}
}

1 Like

So many questions on this topic and none of them are answered. Shopify can you stop ignoring this problem that persists until today?