HomeGuidesAPI ReferenceChangelogDiscussions
HomeLog In
Guides

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

ParameterTypeDescriptionExample
product_id
*Required
StringProduct's ID
ไธปๅ•†ๅ“ID
58d33bed01cda31bfb000029
id
*Required
StringProduct Variation's Key
ๅ•†ๅ“่ฆๆ ผID
5a1c3fc369702d2ad2070000
quantity
*Required
NumberQuantity
(ๆ–ฐๅขž/ๆธ›ๅฐ‘)ๅ•†ๅ“ๆ•ธ้‡
-
*if replace sets as false, allows quantity to be negative number
ๅฆ‚ๆžœ replace ็‚บ false๏ผŒๅ‡†่จฑ quantity ็‚บ่ฒ ๆ•ธ
ruby "quantity":120
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

FieldColumn TypeDescriptionExample
idStringProduct Variation's Key
ๅ•†ๅ“่ฆๆ ผID
5a1c3fc369702d2ad2070000
skuStringProduct Variation sku
ๅ•†ๅ“่ฒจ่™Ÿ
sku_a01
quantityNumberProduct Variation's Current Quantity
ๅ•†ๅ“่ฆๆ ผ็พๆœ‰ๆ•ธ้‡
12
updated_atDateTimeLast Updated Time
ๆœ€ๅพŒๆ›ดๆ–ฐๆ™‚้–“
2018-02-23T04:11:31.059+00:00
product_idStringProduct'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"
}