Create AddonProducts
Function
To create new addon product with Open API
透過Open API 建立新加購品
URL
POST <<api_domain>>/v1/addon_products
Request Parameters
Field | Type | Description | Example |
---|---|---|---|
title_translations | Hash | Addon Product Title 加購品名稱 | { "en": "create by open api"} |
media_ids | Array | Array of Media ID 一組圖片ID | ["603f06f7f6ba0c00451d0f12"] |
unlimited_quantity | Boolean | Addon Product unlimited quantity or not 加購品購買數量限制 | true |
start_at | String | Addon Product start at 生效時間 | "2021-03-03T09:57:09.193Z" |
end_at | String | Addon Product end at 過期時間 | "2022-03-03T09:57:09.193Z" |
main_products | Array | Main Products Information 主商品訊息 | [{ "addon_price": {"dollars": 12}, "_id": "5fa61682e388093728f76a6c" }] |
location_id | String | custom location id | "AB-001" |
sku | String | 加購品SKU | SKU-456344881 |
cost | Hash | Cost 成本 | { "dollars": 12} |
weight | Float | Weigth 重量 | 12.1 |
product_id | String | Shared Product ID 共用商品ID - Note: 選擇現有商品新增為加購品 (會共用庫存) Assign existing product to sell as add on item (the inventory will be shared with selected product) | 603f06f7f6ba0c00451d0f12 |
tax_type | String | Tax type 國內稅項 | "1": 應稅 "3": 免稅 Default: null |
oversea_tax_type | String | Oversea tax type 海外稅項 | "1": 應稅 "2": 零稅率-非經海關出口 "5": 零稅率-經海關出口 Default: null |
JSON Response Sample
{
"_id" : "608b7d0c93919a0046b4337a",
"cost" : {
"cents" : 1200,
"currency_iso" : "HKD",
"currency_symbol" : "HK$",
"dollars" : 12,
"label" : "HK$12.00"
},
"created_at" : "2021-04-30T03:44:12.935Z",
"description_translations" : null,
"end_at" : "2022-03-03T09:57:09.193+00:00",
"location_id" : "AB-001",
"main_products" : [
{
"_id" : "5f86b369e388097aeebc59aa",
"addon_price" : {
"cents" : 1200,
"currency_iso" : "HKD",
"currency_symbol" : "HK$",
"dollars" : 12,
"label" : "HK$12.00"
},
"field_titles" : [],
"lowest_price" : {
"cents" : 1200,
"currency_iso" : "HKD",
"currency_symbol" : "HK$",
"dollars" : 12,
"label" : "HK$12.00"
},
"media" : [
{
"_id" : "5f86b34fe388097aeebc59a9",
"images" : {
"original" : {
"url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/5f86b34fe388097aeebc59a9/original.jpg?1602663247"
},
"thumb" : {
"url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/5f86b34fe388097aeebc59a9/original.jpg?1602663247"
}
}
}
],
"price" : {
"cents" : 1200,
"currency_iso" : "HKD",
"currency_symbol" : "HK$",
"dollars" : 12,
"label" : "HK$12.00"
},
"price_max" : {
"cents" : 0,
"currency_iso" : "HKD",
"currency_symbol" : "HK$",
"dollars" : 0,
"label" : ""
},
"price_range" : "",
"price_sale" : {
"cents" : 0,
"currency_iso" : "HKD",
"currency_symbol" : "HK$",
"dollars" : 0,
"label" : ""
},
"same_price" : false,
"title_translations" : {
"en" : "pencil1"
}
},
{
"_id" : "5fa61682e388093728f76a6c",
"addon_price" : {
"cents" : 1200,
"currency_iso" : "HKD",
"currency_symbol" : "HK$",
"dollars" : 12,
"label" : "HK$12.00"
},
"field_titles" : [
{
"index" : 0,
"key" : "custom",
"label" : "Custom",
"name_translations" : {
"en" : "Custom1",
"zh-hant" : "èªè¨1"
},
"selectorEnabled" : true,
"type_num" : "1"
},
{
"index" : 1,
"key" : "custom",
"label" : "Custom",
"name_translations" : {
"en" : "Custom",
"th" : "à¸à¸³à¸«à¸à¸à¹à¸à¸"
},
"selectorEnabled" : false,
"type_num" : "2"
}
],
"lowest_price" : {
"cents" : 68900,
"currency_iso" : "HKD",
"currency_symbol" : "HK$",
"dollars" : 689,
"label" : "HK$689.00"
},
"media" : [
{
"_id" : "5fa61681e388093728f76a63",
"images" : {
"original" : {
"url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/5fa61681e388093728f76a63/original.jpg?1604720257"
},
"thumb" : {
"url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/5fa61681e388093728f76a63/original.jpg?1604720257"
}
}
}
],
"price" : {
"cents" : 100000,
"currency_iso" : "HKD",
"currency_symbol" : "HK$",
"dollars" : 1000,
"label" : "HK$1,000.00"
},
"price_max" : {
"cents" : 0,
"currency_iso" : "HKD",
"currency_symbol" : "HK$",
"dollars" : 0,
"label" : ""
},
"price_range" : "",
"price_sale" : {
"cents" : 68900,
"currency_iso" : "HKD",
"currency_symbol" : "HK$",
"dollars" : 689,
"label" : "HK$689.00"
},
"same_price" : true,
"title_translations" : {
"en" : "SL-8049 testing",
"zh-hant" : "SL-8049 測試åå"
}
}
],
"media" : [
{
"_id" : "603f06f7f6ba0c00451d0f12",
"alt_translations" : {},
"images" : {
"favicon" : {
"height" : 1920,
"url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/603f06f7f6ba0c00451d0f12/original.jpg?1614743287",
"width" : 1920
},
"favicon_large" : {
"height" : 1920,
"url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/603f06f7f6ba0c00451d0f12/original.jpg?1614743287",
"width" : 1920
},
"favicon_small" : {
"height" : 1920,
"url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/603f06f7f6ba0c00451d0f12/original.jpg?1614743287",
"width" : 1920
},
"original" : {
"height" : 1920,
"url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/603f06f7f6ba0c00451d0f12/original.jpg?1614743287",
"width" : 1920
},
"source" : {
"height" : 1920,
"url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/603f06f7f6ba0c00451d0f12/original.jpg?1614743287",
"width" : 1920
},
"thumb" : {
"height" : 1920,
"url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/603f06f7f6ba0c00451d0f12/original.jpg?1614743287",
"width" : 1920
},
"transparent_large" : {
"height" : 1920,
"url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/603f06f7f6ba0c00451d0f12/original.jpg?1614743287",
"width" : 1920
},
"transparent_thumb" : {
"height" : 1920,
"url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/603f06f7f6ba0c00451d0f12/original.jpg?1614743287",
"width" : 1920
},
"transparent_xlarge" : {
"height" : 1920,
"url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/603f06f7f6ba0c00451d0f12/original.jpg?1614743287",
"width" : 1920
}
}
}
],
"media_ids" : [
"603f06f7f6ba0c00451d0f12"
],
"owner_id" : "5ef06673dd398e02251a219c",
"price" : null,
"promotion_ids" : [
"608b7d0c93919a0046b4337b"
],
"promotions" : [
{
"_id" : "608b7d0c93919a0046b4337b",
"conditions" : [
{
"_id" : "608b7d0c93919a0046b4337c",
"min_item_count" : null,
"min_price" : null,
"promotion_id" : "608b7d0c93919a0046b4337b",
"whitelisted_category_ids" : [],
"whitelisted_product_ids" : [
"5fa61682e388093728f76a6c",
"5f86b369e388097aeebc59aa"
],
"whitelisted_products" : [
{
"_id" : "5fa61682e388093728f76a6c",
"field_titles" : [
{
"index" : 0,
"key" : "custom",
"label" : "Custom",
"name_translations" : {
"en" : "Custom1",
"zh-hant" : "èªè¨1"
},
"selectorEnabled" : true,
"type_num" : "1"
},
{
"index" : 1,
"key" : "custom",
"label" : "Custom",
"name_translations" : {
"en" : "Custom",
"th" : "à¸à¸³à¸«à¸à¸à¹à¸à¸"
},
"selectorEnabled" : false,
"type_num" : "2"
}
],
"lowest_price" : {
"cents" : 68900,
"currency_iso" : "HKD",
"currency_symbol" : "HK$",
"dollars" : 689,
"label" : "HK$689.00"
},
"media" : [
{
"_id" : "5fa61681e388093728f76a63",
"images" : {
"original" : {
"url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/5fa61681e388093728f76a63/original.jpg?1604720257"
},
"thumb" : {
"url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/5fa61681e388093728f76a63/original.jpg?1604720257"
}
}
}
],
"price" : {
"cents" : 100000,
"currency_iso" : "HKD",
"currency_symbol" : "HK$",
"dollars" : 1000,
"label" : "HK$1,000.00"
},
"price_sale" : {
"cents" : 68900,
"currency_iso" : "HKD",
"currency_symbol" : "HK$",
"dollars" : 689,
"label" : "HK$689.00"
},
"same_price" : true,
"title_translations" : {
"en" : "SL-8049 testing",
"zh-hant" : "SL-8049 測試åå"
}
},
{
"_id" : "5f86b369e388097aeebc59aa",
"field_titles" : [],
"lowest_price" : {
"cents" : 1200,
"currency_iso" : "HKD",
"currency_symbol" : "HK$",
"dollars" : 12,
"label" : "HK$12.00"
},
"media" : [
{
"_id" : "5f86b34fe388097aeebc59a9",
"images" : {
"original" : {
"url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/5f86b34fe388097aeebc59a9/original.jpg?1602663247"
},
"thumb" : {
"url" : "https://img-shoplineapp-com.s3.amazonaws.com/media/image_clips/5f86b34fe388097aeebc59a9/original.jpg?1602663247"
}
}
}
],
"price" : {
"cents" : 1200,
"currency_iso" : "HKD",
"currency_symbol" : "HK$",
"dollars" : 12,
"label" : "HK$12.00"
},
"price_sale" : {
"cents" : 0,
"currency_iso" : "HKD",
"currency_symbol" : "HK$",
"dollars" : 0,
"label" : ""
},
"same_price" : false,
"title_translations" : {
"en" : "pencil1"
}
}
]
}
],
"discounted_price" : {
"cents" : 1200,
"currency_iso" : "HKD",
"currency_symbol" : "HK$",
"dollars" : 12,
"label" : "HK$12.00"
}
}
],
"quantity" : 0,
"root_product_id" : null,
"sku" : "ABC",
"start_at" : "2021-03-03T09:57:09.193+00:00",
"status" : "active",
"stock_ids" : null,
"title_translations" : {
"en" : "create by open api"
},
"unlimited_quantity" : true,
"updated_at" : "2021-04-30T03:44:12.935Z",
"weight" : 12.1
}
Sample CURL Example
curl --location --request POST 'http://open.shoplineapp.com/v1/addon_products' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer ${token}' \
--header 'Content-Type: application/json' \
--data-raw '{
"title_translations": { "en": "create by open api"},
"media_ids": ["603f06f7f6ba0c00451d0f12"],
"unlimited_quantity": true,
"start_at": "2021-03-03T09:57:09.193Z",
"end_at": "2022-03-03T09:57:09.193Z",
"main_products": [
{
"addon_price": {"dollars": 12},
"_id": "5fa61682e388093728f76a6c"
},
{ "addon_price": {"dollars": 12}, "_id": "5f86b369e388097aeebc59aa" }
],
"location_id": "AB-001",
"sku": "ABC",
"cost": { "dollars": 12},
"weight": 12.1
}'
Updated 12 months ago