跳到主要内容

getCartByKeys

按购物项的 key 批量查询当前价格、库存、商品名与图片。购物车本身保存在客户端(如 localStorage),展示购物车时用本接口刷新实时数据。

属性值
方法POST
路径/config/getCartByKeys
鉴权公开
Content-Typeapplication/json

请求体​

{
"area": "us",
"language": "en",
"items": [
{ "sortKey": "rings", "productKey": "solitaire", "comboKey": "0.5ct-gold" }
]
}
字段类型必填说明
areastring否访客地区代码,默认 us
languagestring否语言代码,默认 en
itemsarray是购物项数组
items[].sortKeystring是分类 key
items[].productKeystring是商品 key
items[].comboKeystring是变体 key

响应​

已下架或不存在的购物项不会出现在 list 中,客户端应据此把它从购物车移除。

{
"code": 0,
"message": "",
"data": {
"list": [
{
"id": 0,
"comboName": "",
"comboKey": "",
"name": "",
"image": "",
"sortKey": "",
"productKey": "",
"areaInfo": {}
}
]
}
}
字段类型说明
comboName / comboKeystring变体名称与 key
name / imagestring商品名与主图
sortKey / productKeystring分类与商品 key
areaInfoobject该地区下的价格与库存;该地区未单独定价时使用店铺默认价格

示例​

curl -s -X POST 'https://service.boldsaasify.com/config/getCartByKeys' \
-H 'Content-Type: application/json' \
-H 'X-Site-Domain: your-store.com' \
-d '{"area":"us","language":"en","items":[{"sortKey":"rings","productKey":"solitaire","comboKey":"0.5ct-gold"}]}'