getCartByKeys
按购物项的 key 批量查询当前价格、库存、商品名与图片。购物车本身保存在客户端(如 localStorage),展示购物车时用本接口刷新实时数据。
| 属性 | 值 |
|---|---|
| 方法 | POST |
| 路径 | /config/getCartByKeys |
| 鉴权 | 公开 |
| Content-Type | application/json |
请求体
{
"area": "us",
"language": "en",
"items": [
{ "sortKey": "rings", "productKey": "solitaire", "comboKey": "0.5ct-gold" }
]
}
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
area | string | 否 | 访客地区代码,默认 us |
language | string | 否 | 语言代码,默认 en |
items | array | 是 | 购物项数组 |
items[].sortKey | string | 是 | 分类 key |
items[].productKey | string | 是 | 商品 key |
items[].comboKey | string | 是 | 变体 key |
响应
已下架或不存在的购物项不会出现在 list 中,客户端应据此把它从购物车移除。
{
"code": 0,
"message": "",
"data": {
"list": [
{
"id": 0,
"comboName": "",
"comboKey": "",
"name": "",
"image": "",
"sortKey": "",
"productKey": "",
"areaInfo": {}
}
]
}
}
| 字段 | 类型 | 说明 |
|---|---|---|
comboName / comboKey | string | 变体名称与 key |
name / image | string | 商品名与主图 |
sortKey / productKey | string | 分类与商品 key |
areaInfo | object | 该地区下的价格与库存;该地区未单独定价时使用店铺默认价格 |
示例
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"}]}'