Products
Update stock by SKU
Sets the quantity of the product or variant that has this SKU — ideal for suppliers keeping stock in sync. Stock tracking is switched on.
PATCH
https://elmatajer.com/api/v1/vendor/products/sku/{sku}/quantityPermission:
products.writePath parameters
| Name | Type | Required | Description |
|---|---|---|---|
sku | string | Yes | A product SKU or a variant SKU. |
Request body
| Name | Type | Required | Description |
|---|---|---|---|
quantity | integer | Yes | 0 or more. |
Request
curl -X PATCH "https://elmatajer.com/api/v1/vendor/products/sku/TS-001-BL-L/quantity" \
-H "Api-Key: YOUR_API_KEY" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"quantity":25}'
const res = await fetch("https://elmatajer.com/api/v1/vendor/products/sku/TS-001-BL-L/quantity", {
method: "PATCH",
headers: {
"Api-Key": process.env.ELMATAJER_API_KEY,
"Accept": "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify({
"quantity": 25
})
});
const data = await res.json();
$ch = curl_init("https://elmatajer.com/api/v1/vendor/products/sku/TS-001-BL-L/quantity");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Api-Key: " . getenv('ELMATAJER_API_KEY'), "Accept: application/json", "Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
'quantity' => 25
]),
]);
$data = json_decode(curl_exec($ch), true);
Response 200
{
"status": "ok",
"data": {
"type": "variant",
"id": 911,
"product_id": 22900,
"sku": "TS-001-BL-L",
"quantity": 25
}
}
A product whose stock lives on its variants answers 422 variant_stock — send the variant's SKU.