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

Parameter

Type

Description

Example

id *Required

String

Product's ID
商品ID

quantity
*Required

Number

Quantity
(新增/減少)商品數量

  • if replace sets as false, allows quantity to be negative number
    如果 replace 為 false,准許 quantity 為負數
ruby
"quantity"=21

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
    增加/減少數量\

  • Default: true

ruby
"replace":false

Response fields

Field

Type

Description

Example

id

String

Product's ID
商品ID

5a8165efe38809548f0000f8

sku

String

Product's sku
商品貨號

SKU_001

quantity

Number

Product's Current quantity
商品現有數量

21

updated_at

DateTime

Last 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"
}