HomeGuidesAPI ReferenceChangelogDiscussions
HomeLog In
Guides

Update Product Quantity

📘

Notice 提醒

Do not allow to update quantity of the product which contains one or multiple variations or has unlimited quantity
不允許更新有規格或無限數量的商品

*若要更新規格數量,請使用Update Product Variation Quantity

*若要更新不同倉庫(warehouse) 的商品庫存,請參考 Get Stock/Quantity for Warehouse (Product/Gift/Add-on)

Function

To update product's quantity with open API
透過open API 更新主商品數量

URL

PUT <<api_domain>>/v1/products/:id/update_quantity

Request parameters

ParameterTypeDescriptionExample
id
*Required
StringProduct's ID
商品ID
quantity
*Required
NumberQuantity
(新增/減少)商品數量
-
*if replace sets as false, allows quantity to be negative number
如果 replace 為 false,准許 quantity 為負數
ruby "quantity"=21
replaceBooleanWhether 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
增加/減少數量

*Default: true
ruby "replace":false

Response fields

FieldTypeDescriptionExample
idStringProduct's ID
商品ID
5a8165efe38809548f0000f8
skuStringProduct's sku
商品貨號
SKU_001
quantityNumberProduct's Current quantity
商品現有數量
21
updated_atDateTimeLast Updated Time
商品最後更新時間
2018-02-23T04:17:15.544+00:00

Response Example

{
    "id": "5a8165efe38809548f0000f8",
    "sku": "SKU_001",
    "quantity": 21,
    "updated_at": "2018-02-23T04:17:15.544+00:00"
}