HomeGuidesAPI ReferenceChangelogDiscussions
HomeLog In
Guides

Update AddonProducts

Function

To update information about existing addon products with open API
透過open API 更新加購品

URL

PUT <<api_domain>>/v1/addon_products/:id

Requset Parameters

FieldTypeDescriptionExample
title_translationsHashAddon Product Title
加購品名稱
{ "en": "create by open api"}
media_idsArrayArray of Media ID
一組圖片ID
["603f06f7f6ba0c00451d0f12"]
unlimited_quantityBooleanAddon Product unlimited quantity or not
加購品購買數量限制
true
start_atStringAddon Product start at
生效時間
"2021-03-03T09:57:09.193Z"
end_atStringAddon Product end at
過期時間
"2022-03-03T09:57:09.193Z"
main_productsArrayMain Products Information
主商品訊息
[{ "addon_price": {"dollars": 12}, "_id": "5fa61682e388093728f76a6c" }]
location_idStringcustom location id"AB-001"
skuString加購品SKUSKU-456344881
costHashCost
成本
{ "dollars": 12}
weightFloatWeigth
重量
12.1

JSON REsponse Sample

{
   "_id" : "608bc2ee93919a0046b4337f",
   "cost" : {
      "cents" : 1200,
      "currency_iso" : "HKD",
      "currency_symbol" : "HK$",
      "dollars" : 12,
      "label" : "HK$12.00"
   },
   "created_at" : "2021-04-30T08:42:22.310Z",
   "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" : [
      "608bc2ee93919a0046b43380"
   ],
   "promotions" : [
      {
         "_id" : "608bc2ee93919a0046b43380",
         "conditions" : [
            {
               "_id" : "608bc2ee93919a0046b43381",
               "min_item_count" : null,
               "min_price" : null,
               "promotion_id" : "608bc2ee93919a0046b43380",
               "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-30T08:54:47.687Z",
   "weight" : 12.1
}

Sample CURL Example

curl --location --request PUT '<<api_domain>>/v1/addon_products/608bc2ee93919a0046b4337f' \
--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
}'