Add Product Variation
Function
Add a variation product under an existing main product.
在現有主商品之下新增規格商品
URL
POST <<api_domain>>/v1/products/:product_id/variations
Request Parameters
Parameter | Type | Description | Example |
---|---|---|---|
default_show_image_selector | Boolean | Show image selector on product details page 顯示選項圖片於商品頁面 default false | ruby default_show_image_selector: false |
product_id *Required | String | Product ID 主商品ID | ruby 5d3594c276e7ec003b7021c0 |
variant_options *Required | Array | Product Variations 商品規格 - *Maximum allows 3 types of variant option for a product, type allow ( color , size , custom_1 , custom_2 , custom_3 )最多支援三種不同的規格種類,支援 color , size , custom_1 , custom_2 , custom_3 - 對相同 type 的 variant_options 開啟顯示選項圖片於商品頁面,可在相同 type 的 variant_options 每一個加上 "selector_enabled": true ,並且確定每一個有設定 selector_enabled 的 variant_option 都有 media_id | ruby "variant_options": [ { "name_translations": { "zh-hant": "綠", "en": "green" }, "type": "color",}, { "name_translations": { "en": "L1", "zh-hant": "大1" }, "type": "custom_1",}, { "name_translations": { "en": "Long1", "zh-hant": "長1" }, "type": "custom_2",} ] |
location_id | String | Location ID 儲位編號 | ruby "location_id": "BA-001" |
sku | String | SKU ( Stock Keeping Unit ) 商品貨號 | ruby "sku": "SL-GU-0001" |
price *Required | Float | Product Price 原價格 | ruby "price": 999 |
member_price | Float | Member Price 會員價 | ruby "member_price": 900 |
quantity *Required | Integer | Product Quantity 商品數量 | ruby "quantity": 100 |
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": 80 |
cost | Float | Cost 成本價 | "cost": 30 |
weight | Float | Weight (kg) 重量 (公斤) | "weight": 1.2 |
gtin | String | barcode 商品條碼編號 | "gtin": "1234567890" |
preorder_limit | Integer | [Will release on 2023 May 24th] Preorder Limit (set to -1 if it's unlimited quantity) 預購上限(-1表示無限) | "preorder_limit": 30 |
Request Example
{
"variant_options":[
{
"name_translations":{
"zh-hant":"綠",
"en":"green"
},
"type":"color"
},
{
"name_translations":{
"en":"L1",
"zh-hant":"大1"
},
"type":"custom_1"
}
],
"location_id":"BA-001",
"sku":"SL-GU-0001",
"price":999,
"member_price":900,
"quantity":100,
"image":"https://the-allstars.com/blog/images/articl/articl7.jpg",
"price_sale":999,
"cost":999,
"weight":1.2,
"gtin":"1234567890",
"preorder_limit":999
}
Response Example
Also same with Get Product
{
"id": "5d5baa89c34f740006ce1adc",
"fields_translations": {
"en": [
"green",
"L1",
"Long1"
],
"zh-hant": [
"綠",
"大1",
"長1"
]
},
"price": {
"cents": 999,
"currency_symbol": "NT$",
"currency_iso": "TWD",
"label": "NT$999",
"dollars": 999.0
},
"price_sale": {
"cents": 0,
"currency_symbol": "NT$",
"currency_iso": "TWD",
"label": "",
"dollars": 0.0
},
"member_price": {
"cents": 900,
"currency_symbol": "NT$",
"currency_iso": "TWD",
"label": "NT$900",
"dollars": 900.0
},
"quantity": 100,
"unlimited_quantity": null,
"media": {},
"sku": "SL-GU-0001",
"location_id": "BA-001",
"variant_option_ids": [
"5d5baa896c20ca00293f7455",
"5d5baa896c20ca00293f7456",
"5d5baa896c20ca00293f7457"
],
"barcode": null,
"gtin": "1234567890",
"preorder_limit":999,
"out_of_stock_orderable": false,
"subscription_enabled": false,
"subscription_period_duration": 30,
"filter_tags": []
}
Updated 12 months ago