Update Stock/Quantity for Warehouse (Product/Gift/Add-on Product)
Function
To update the product's/ gift's/ add-on product's stock with its ID
使用商品 ID 更新商品/ 贈品/ 加購品在各個倉庫的庫存
URL
Product stock: PUT <<api_domain>>/v1/products/:id/stocks
Gift stock: PUT <<api_domain>>/v1/gifts/:id/stocks
Add-on stock: PUT <<api_domain>>/v1/addon_products/:id/stocks
Request Parameters
Parameter | Type | Description | Example |
|---|---|---|---|
id
| String | Product’s id | 5d3594c276e7ec003b7021c0 |
warehouse_id
| String | Warehouse’s id Only warehouse with status "active" can be updated |
|
quantity
| Number | Quantity Negative number is allowed |
|
variation_id | String | Product Variation's id |
|
is_replace | Boolean | Whether replacing the original quantity true: replace the product's quantity with the number you provided false: increase/decrease the quantity with the number you provided |
|
Response Fields
Field | Type | Description | Example |
|---|---|---|---|
id | String | Product’s id | 5d3594c276e7ec003b7021c0 |
title_translations | Title translations | Please check stock data below | |
stocks | Stock[] | Each stock | Please check stock data below |
Response Example
{
"id": "5ef1e5cbf1159c004ed9e789",
"title_translations": {
"zh-hant": "測試商品*"
},
"variations": [
{
"id": "5ef1e5cb214bbc0013813cfd",
"fields_translations": {
"en": [
"s"
],
"zh-hant": [
"s"
]
},
"stocks": [
{
"warehouse_id": "5e83216e2e4f81001e756014",
"quantity": 0
},
{
"warehouse_id": "5e831cb68fa5fc000f9925ab",
"quantity": 0
}
]
},
{
"id": "5ef1e5cb214bbc0013813cfe",
"fields_translations": {
"en": [
"m"
],
"zh-hant": [
"m"
]
},
"stocks": [
{
"warehouse_id": "5e83216e2e4f81001e756014",
"quantity": 0
},
{
"warehouse_id": "5e831cb68fa5fc000f9925ab",
"quantity": 0
}
]
}
]
}{
"id": "5ef1e613560e8e2166ce2f03",
"title_translations": {
"zh-hant": "測試商品"
},
"stocks": [
{
"warehouse_id": "5e83216e2e4f81001e756014",
"quantity": 0
},
{
"warehouse_id": "5e831cb68fa5fc000f9925ab",
"quantity": 0
}
]
}Updated 21 days ago