Update Product Variation

Function

Update information of an existing product variation.
針對現有規格商品做訊息更新

URL

PUT https://open.shopline.io/v1/products/:product_id/variations/:id

Request Parameters

Parameter

Type

Description

Example

product_id *Required

String

Product ID
主商品ID

5df2fd9dc7ccf70012c2111b

id
*Required

String

Variant ID
規格商品ID

5e325db736b1ed0014dd2bdd

location_id

String

Location ID
儲位編號

"location_id": "87722"

sku

String

SKU ( Stock Keeping Unit )
商品貨號

"sku": "24235"

price

Float

Product Price
原價格

"price":460

member_price

Float

Member Price
會員價

"member_price": 420

quantity

Integer

Product Quantity
商品數量


Directly update the quantity of the variation. The quantity is between -9999999 to 9999999.
直接更新規格商品數量。商品數量要在 -9999999 - 9999999 之間。

"quantity": 90

image

String

Link of Images
圖片連結

  • Only allows https
ruby
 "image": "https://the-allstars.com/blog/images/articl/articl7.jpg"

price_sale

Float

Sale price
特價

"price_sale": 300

cost

Float

Cost
成本價

"cost": 50

weight

Float

Weight (kg)
重量 (公斤)

"weight": 1.2

gtin

String

Barcode
商品條碼編號

"gtin": "1234567890"

preorder_limit

Integer

Preorder Limit (set to -1 if it's unlimited quantity)
預購上限(-1表示無限)

"preorder_limit": 50

Request Example

{

   "sku": "24235",
   "location_id": "87722",
   "quantity": 90,
   "price":460,
   "member_price":420,
   "image": "https://the-allstars.com/blog/images/articl/articl7.jpg",
   "price_sale": 300,
   "cost": 30,
   "weight": 1.2,
   "gtin": "1234567890",
   "preorder_limit": 30
}

Response Example

Also same with Get Product

{
    "_id": "5e325db7596dfe7c20c7d11a",
    "barcode_type": "Code 128",
    "cost": {
        "cents": 0,
        "currency_symbol": "NT$",
        "currency_iso": "TWD",
        "label": "",
        "dollars": 0.0
    },
    "preorder_limit": 30,
    "created_at": "2020-01-30T04:38:15.576+00:00",
    "fields": [
        {
            "name_translations": {
                "en": "en8",
                "zh-hant": "chinese8"
            }
        },
        {
            "name_translations": {
                "en": "cus8",
                "zh-hant": "cus8"
            }
        }
    ],
    "fields_translations": {
        "en": [
            "en8",
            "cus8"
        ],
        "zh-hant": [
            "chinese8",
            "cus8"
        ]
    },
    "gtin": "1234567890",
    "key": "5e325db736b1ed0014dd2bdd",
    "location_id": "87722",
    "max_order_quantity": 10,
    "media_id": null,
    "member_price": {
        "cents": 420,
        "currency_symbol": "NT$",
        "currency_iso": "TWD",
        "label": "NT$420",
        "dollars": 420.0
    },
    "mpn": null,
    "price": {
        "cents": 460,
        "currency_symbol": "NT$",
        "currency_iso": "TWD",
        "label": "NT$460",
        "dollars": 460.0
    },
    "price_sale": {
        "cents": 0,
        "currency_symbol": "NT$",
        "currency_iso": "TWD",
        "label": "",
        "dollars": 0.0
    },
    "quantity": 90,
    "root_product_variation_id": null,
    "sku": "24235",
    "stock_ids": null,
    "unlimited_quantity": null,
    "updated_at": "2020-03-17T09:20:47.020+00:00",
    "variant_option_ids": [
        "5e325db7596dfe7c20c7d118",
        "5e325db7596dfe7c20c7d119"
    ],
    "wapos_id": null,
    "weight": 0.0,
    "id": "5e325db7596dfe7c20c7d11a",
    "out_of_stock_orderable": false,
    "subscription_enabled": false,
    "subscription_period_duration": 30,
    "filter_tags": []
}