Update Product Variation Quantity

📘

Notice 提醒

Product unlimited_quantity should be false
商品 無限數量 需要設定為 false

Function

To update product variation's quantity with open API
透過open API 更新規格數量

URL

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

Request parameters

Parameter

Type

Description

Example

product_id *Required

String

Product's ID
主商品ID

58d33bed01cda31bfb000029

id
*Required

String

Product Variation's Key
商品規格ID

5a1c3fc369702d2ad2070000

quantity
*Required

Number

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

  • This value should be between -9999999 and 9999999.
    數值必須在 -9999999 和 9999999 之間。
ruby
"quantity":120

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

Column Type

Description

Example

id

String

Product Variation's Key
商品規格ID

5a1c3fc369702d2ad2070000

sku

String

Product Variation sku
商品貨號

sku_a01

quantity

Number

Product Variation's Current Quantity
商品規格現有數量

12

updated_at

DateTime

Last Updated Time
最後更新時間

2018-02-23T04:11:31.059+00:00

product_id

String

Product's ID
主商品ID

58d33bed01cda31bfb000029

Response Example

{
    "id": "5a1c3fc369702d2ad2070000",
    "sku": "sku_a01",
    "quantity": 12,
    "updated_at": "2018-02-23T04:11:31.059+00:00",
    "product_id": "58d33bed01cda31bfb000029"
}