Set the stock of many products and variations in one request, by id, product code, EAN code or ERP id.
Update stock in bulk
Sets the stock of products and variations. The body is a JSON array; each element has the new stock and
exactly one identifier: code, ean_code, erp_id, product_id or variation_id. An element with no
identifier or more than one returns 400 for the whole request.
code,ean_codeanderp_idare matched exactly against both products and variations, so one element can update several products and variations. Deleted products and variations are not matched.- If several elements match the same product or variation, the last one wins.
- The change is recorded in the stock history with the comment
REST API. - When the shop computes product stock from variations (the
product_stock_by_variationssetting), a product that has variations (deleted ones don't count) is skipped: set the stock on its variations. Updating a variation then also recomputes its product's stock, and the product is listed initemstoo.
If no element updated anything, the response is 404. Otherwise elements that updated nothing (unknown,
deleted or skipped targets) are listed in not_found. The response items have no result_index.
Update stock in bulk › Request Body
stockThe new stock quantity.
codeMatches products by product code and variations by variation code.
ean_codeMatches products and variations by EAN code.
erp_idMatches products and variations by ERP id.
product_idMatches the product with this id.
variation_idMatches the variation with this id.
Update stock in bulk › Responses
The updated products and variations.
hrefThe URL of the request.
The request elements that updated nothing, as {"<identifier>": <value as sent>}. Present only when some elements matched and some didn't.
The updated products and variations.