商品推荐
Product Recommendations API 可用于为指定商品推荐相关商品。
所有 Ajax API 请求应使用多语言 URL,以便为访客提供一致的体验。
获取商品的推荐商品
GET /{locale}/api/product/similar-products
以下示例请求获取特定商品的推荐商品:
GET /{locale}/api/product/similar-products?product_id={product-id}
请求示例
fetch(window.SHOPLAZZA.routes.root + '/api/product/similar-products?product_id=588ed0ce-40af-44c7-8dea-afa18b489ef8&page=1&per_page=4')
.then((response) => response.json())
.then((data) => {
// do something...
});
请求参数
您要展示推荐商品的商品的唯一商品 ID。
结果的基于 1 的页码。
限制结果数量。
响应
- 数据结构
- 示例
- Array [
- Array [
- ]
- Array [
- Array [
- ]
- Array [
- ]
- ]
- Array [
- ]
- Array [
- ]
- Array [
- ]
- ]
data object
响应数据主体。
返回的商品数量。
products object[]
商品列表。
商品 ID。
商品名称。
商品的简要描述。
商品的供应商。
商品供应商的链接。
商品是否只有默认款式。
是否需要物流配送。
是否需要计税。
商品缺货时是否继续销售。
库存数量。
是否启用库存追踪。
资源是否已发布。
用于资源链接的 handle(URL 友好别名)。
商品的 SPU(标准产品单元)。
对象上的备注。
款式是否必须单独配图。
商品的虚拟销量。
是否在前台展示虚拟销量。
是否独立管理 SEO 设置。
创建时间(ISO-8601 格式)。
最后更新时间(ISO-8601 格式)。
对象上的标签。
是否可购买。
款式中的最低价格,以店铺主货币单位表示。
款式中的最高价格,以店铺主货币单位表示。
商品价格,以店铺主货币单位表示。
划线价。
款式中的最低划线价。
款式中的最高划线价。
商品页的相对地址。
发布时间(ISO-8601 格式)。
销量。
image object
商品的第一张图片。
图片的地址。
图片宽度(像素)。
图片高度(像素)。
图片的替代文本。
图片文件在图床上的路径。
图片宽度除以高度得到的宽高比。
页面元信息中的 SEO 标题。
页面元信息中的 SEO 描述。
页面元信息中的 SEO 关键词。
options object[]
商品的属性,例如颜色、尺码。
商品属性的 ID。
商品属性名称,例如 Color。
属性的排序位置。
商品属性的可选值列表。
variants object[]
商品的款式列表。
款式 ID。
款式标题,由各属性取值用 - 连接而成。
重量单位,例如 kg。
库存数量。
款式的 SKU,用于库存管理。
款式的条形码。
在列表中的排序位置。
该款式在第一个商品属性上的取值。
该款式在第二个商品属性上的取值。
该款式在第三个商品属性上的取值。
对象上的备注。
款式关联的图片。
款式的重量。
划线价。
款式价格,以店铺主货币单位表示。
是否可购买。
仍可购买的数量。
options object[]
该款式在各商品属性上的取值。
商品属性名称,例如 Color。
该商品属性被选中的取值。
选中该款式的商品页相对地址。
当前适用的折扣比率。
商品的闪购活动信息。
销量。
wholesale_price object[]
批发价梯度列表。
该批发价梯度的单价。
该批发价梯度要求的最小数量。
以店铺主货币单位表示的零售价。
images object[]
商品图片列表。
图片的地址。
图片宽度(像素)。
图片高度(像素)。
图片的替代文本。
图片文件在图床上的路径。
图片宽度除以高度得到的宽高比。
商品的闪购活动信息。
当前适用的折扣比率。
商品的各款式价格是否不同。
是否支持混批。
以店铺主货币单位表示的零售价。
款式中的最低零售价。
款式中的最高零售价。
min_price_variant object
价格最低的款式。
款式 ID。
款式标题,由各属性取值用 - 连接而成。
重量单位,例如 kg。
库存数量。
款式的 SKU,用于库存管理。
款式的条形码。
在列表中的排序位置。
该款式在第一个商品属性上的取值。
该款式在第二个商品属性上的取值。
该款式在第三个商品属性上的取值。
对象上的备注。
款式关联的图片。
款式的重量。
划线价。
款式价格,以店铺主货币单位表示。
是否可购买。
仍可购买的数量。
options object[]
该款式在各商品属性上的取值。
商品属性名称,例如 Color。
该商品属性被选中的取值。
选中该款式的商品页相对地址。
当前适用的折扣比率。
商品的闪购活动信息。
销量。
wholesale_price object[]
批发价梯度列表。
该批发价梯度的单价。
该批发价梯度要求的最小数量。
以店铺主货币单位表示的零售价。
商品类型。
商品描述。
商品评价的平均星级。
商品的顾客评价数量。
响应返回的结果说明。
请求结果标识,success 或 0 表示请求成功。
{
"data": {
"count": 3,
"products": [
{
"id": "b3b656ae-504f-4f01-a054-879a610925e3",
"title": "Sample product",
"brief": "Sample product",
"vendor": "",
"vendor_url": "",
"has_only_default_variant": false,
"requires_shipping": true,
"taxable": false,
"inventory_policy": "deny",
"inventory_quantity": 217,
"inventory_tracking": true,
"published": true,
"handle": "Sample product",
"spu": "1111",
"note": "",
"need_variant_image": false,
"fake_sales": 0,
"display_fake_sales": false,
"independent_seo": false,
"created_at": "2026-06-08T08:12:08Z",
"updated_at": "2026-08-10T06:53:57Z",
"tags": "",
"available": true,
"price_min": "10",
"price_max": "90",
"price": "10",
"compare_at_price": "20.00",
"compare_at_price_min": "0.00",
"compare_at_price_max": "20.00",
"url": "/products/%E6%B5%8B%E8%AF%95%E5%95%86%E5%93%81?cfb=7e538b25-843c-43f1-9d8c-5fb8ab94de62&scm=relative.v14.17.18.19.20&score=0.600001&ssp=spz",
"published_at": "2026-07-30T02:28:23Z",
"sales": 0,
"image": {
"src": "//img.staticdj.com/50fa9b8c054f4d11b0d765de5f35dd4e.png",
"width": 1254,
"height": 1254,
"alt": "",
"path": "50fa9b8c054f4d11b0d765de5f35dd4e.png",
"aspect_ratio": 1
},
"meta_title": "Sample product",
"meta_description": "Sample product",
"meta_keyword": "",
"options": [
{
"id": "5d6c5366-5c4b-4d3b-8ecd-a83d6d5b1abf",
"name": "Color",
"position": 1,
"values": [
"Black",
"Red",
"White"
]
},
{
"id": "af2cadff-8ef3-4b10-a9ec-fd92a30cb18c",
"name": "Size",
"position": 2,
"values": [
"S",
"M",
"L"
]
}
],
"variants": [
{
"id": "0699bc80-19ae-41bb-87c4-dbcbe5ed90a0",
"title": "Black-S",
"weight_unit": "kg",
"inventory_quantity": 48,
"sku": "1111-BLACK-S-A001001",
"barcode": "",
"position": 1,
"option1": "Black",
"option2": "S",
"option3": "",
"note": "",
"image": null,
"weight": "0.00",
"compare_at_price": "20",
"price": "10",
"available": true,
"available_quantity": 48,
"options": [
{
"name": "Color",
"value": "Black"
},
{
"name": "Size",
"value": "S"
}
],
"url": "/products/Sample product?variant=0699bc80-19ae-41bb-87c4-dbcbe5ed90a0",
"off_ratio": 50,
"flashsale_info": [],
"sales": 0,
"wholesale_price": [
{
"price": "10",
"min_quantity": 1
}
],
"retail_price": "20"
},
{
"id": "e48af6fb-dbec-4efa-9db2-94ad8f8853e4",
"title": "Black-M",
"weight_unit": "kg",
"inventory_quantity": 7,
"sku": "1111-Black-M-A001002",
"barcode": "",
"position": 2,
"option1": "Black",
"option2": "M",
"option3": "",
"note": "",
"image": null,
"weight": "0.00",
"compare_at_price": "0",
"price": "20",
"available": true,
"available_quantity": 7,
"options": [
{
"name": "Color",
"value": "Black"
},
{
"name": "Size",
"value": "M"
}
],
"url": "/products/Sample product?variant=e48af6fb-dbec-4efa-9db2-94ad8f8853e4",
"off_ratio": 0,
"flashsale_info": [],
"sales": 0,
"wholesale_price": [
{
"price": "20",
"min_quantity": 1
}
],
"retail_price": "0"
},
{
"id": "f9a60813-bbec-49db-88d0-3d851a42d696",
"title": "White-L",
"weight_unit": "kg",
"inventory_quantity": 44,
"sku": "1111-White-L-A001009",
"barcode": "",
"position": 9,
"option1": "White",
"option2": "L",
"option3": "",
"note": "",
"image": null,
"weight": "0.00",
"compare_at_price": "0",
"price": "90",
"available": true,
"available_quantity": 44,
"options": [
{
"name": "Color",
"value": "White"
},
{
"name": "Size",
"value": "L"
}
],
"url": "/products/Sample product?variant=f9a60813-bbec-49db-88d0-3d851a42d696",
"off_ratio": 0,
"flashsale_info": [],
"sales": 0,
"wholesale_price": [
{
"price": "90",
"min_quantity": 1
}
],
"retail_price": "0"
}
],
"variants_count": 0,
"images": [
{
"src": "//img.staticdj.com/50fa9b8c054f4d11b0d765de5f35dd4e.png",
"width": 1254,
"height": 1254,
"alt": "",
"path": "50fa9b8c054f4d11b0d765de5f35dd4e.png",
"aspect_ratio": 1
}
],
"flashsale_info": [],
"off_ratio": 50,
"price_varies": true,
"ifb": "7e538b25-843c-43f1-9d8c-5fb8ab94de62",
"cfb": "7e538b25-843c-43f1-9d8c-5fb8ab94de62",
"ssp": "",
"scm": "relative.v14.17.18.19.20",
"score": 0.600001,
"mixed_wholesale": false,
"retail_price": "20.00",
"retail_price_min": "0.00",
"retail_price_max": "20.00",
"min_price_variant": {
"id": "0699bc80-19ae-41bb-87c4-dbcbe5ed90a0",
"title": "Black-S",
"weight_unit": "kg",
"inventory_quantity": 48,
"sku": "1111-BLACK-S-A001001",
"barcode": "",
"position": 1,
"option1": "Black",
"option2": "S",
"option3": "",
"note": "",
"image": null,
"weight": "0",
"compare_at_price": "20",
"price": "10",
"available": true,
"available_quantity": 48,
"options": [
{
"name": "Color",
"value": "Black"
},
{
"name": "Size",
"value": "S"
}
],
"url": "/products/Sample product?variant=0699bc80-19ae-41bb-87c4-dbcbe5ed90a0",
"off_ratio": 50,
"flashsale_info": [],
"sales": 0,
"wholesale_price": [
{
"price": "10",
"min_quantity": 1
}
],
"retail_price": "20"
},
"product_type": "default",
"description": "",
"comment_avg_star": 0,
"comment_count": 0
},
{
"id": "79f46343-605c-4100-a9d5-d8a11dae3fef",
"title": "Cozy Knit Tee",
"brief": "",
"vendor": "",
"vendor_url": "",
"has_only_default_variant": true,
"requires_shipping": true,
"taxable": false,
"inventory_policy": "deny",
"inventory_quantity": 109,
"inventory_tracking": true,
"published": true,
"handle": "cozy-knit-tee",
"spu": "",
"note": "",
"need_variant_image": false,
"fake_sales": 0,
"display_fake_sales": false,
"independent_seo": false,
"created_at": "2026-06-24T06:17:25Z",
"updated_at": "2026-08-04T06:58:45Z",
"tags": "",
"available": true,
"price_min": "105",
"price_max": "105",
"price": "105",
"compare_at_price": "0.00",
"compare_at_price_min": "0.00",
"compare_at_price_max": "0.00",
"url": "/products/%E8%88%92%E9%80%82%E9%92%88%E7%BB%87t%E6%81%A4?cfb=7e538b25-843c-43f1-9d8c-5fb8ab94de62&scm=relative.v14.17.18.19.20&score=0.5333336666666667&ssp=spz",
"published_at": "2026-07-30T02:17:25Z",
"sales": 0,
"image": {
"src": "//img.staticdj.com/66dde64782015ee2e4f31a1e08781d92.svg",
"width": 1,
"height": 1,
"alt": "",
"path": "66dde64782015ee2e4f31a1e08781d92.svg",
"aspect_ratio": 1
},
"meta_title": "Cozy Knit Tee",
"meta_description": "",
"meta_keyword": "",
"options": [],
"variants": [
{
"id": "e660a2bc-c8ec-44ef-a3ab-028d317eedd9",
"title": "",
"weight_unit": "kg",
"inventory_quantity": 109,
"sku": "",
"barcode": "",
"position": 1,
"option1": "",
"option2": "",
"option3": "",
"note": "",
"image": null,
"weight": "0.00",
"compare_at_price": "0",
"price": "105",
"available": true,
"available_quantity": 109,
"options": [],
"url": "/products/cozy-knit-tee?variant=e660a2bc-c8ec-44ef-a3ab-028d317eedd9",
"off_ratio": 0,
"flashsale_info": [],
"sales": 0,
"wholesale_price": [
{
"price": "105",
"min_quantity": 1
}
],
"retail_price": "0"
}
],
"variants_count": 0,
"images": [
{
"src": "//img.staticdj.com/66dde64782015ee2e4f31a1e08781d92.svg",
"width": 1,
"height": 1,
"alt": "",
"path": "66dde64782015ee2e4f31a1e08781d92.svg",
"aspect_ratio": 1
}
],
"flashsale_info": [],
"off_ratio": 0,
"price_varies": false,
"ifb": "7e538b25-843c-43f1-9d8c-5fb8ab94de62",
"cfb": "7e538b25-843c-43f1-9d8c-5fb8ab94de62",
"ssp": "",
"scm": "relative.v14.17.18.19.20",
"score": 0.5333336666666667,
"mixed_wholesale": false,
"retail_price": "0.00",
"retail_price_min": "0.00",
"retail_price_max": "0.00",
"min_price_variant": {
"id": "e660a2bc-c8ec-44ef-a3ab-028d317eedd9",
"title": "",
"weight_unit": "kg",
"inventory_quantity": 109,
"sku": "",
"barcode": "",
"position": 1,
"option1": "",
"option2": "",
"option3": "",
"note": "",
"image": null,
"weight": "0",
"compare_at_price": "0",
"price": "105",
"available": true,
"available_quantity": 109,
"options": [],
"url": "/products/cozy-knit-tee?variant=e660a2bc-c8ec-44ef-a3ab-028d317eedd9",
"off_ratio": 0,
"flashsale_info": [],
"sales": 0,
"wholesale_price": [
{
"price": "105",
"min_quantity": 1
}
],
"retail_price": "0"
},
"product_type": "default",
"description": "",
"comment_avg_star": 0,
"comment_count": 0
},
{
"id": "dfe46c91-5f48-4099-ba1f-0168b1632601",
"title": "Shipping Protection",
"brief": "",
"vendor": "",
"vendor_url": "",
"has_only_default_variant": false,
"requires_shipping": false,
"taxable": false,
"inventory_policy": "",
"inventory_quantity": 0,
"inventory_tracking": false,
"published": true,
"handle": "Shipping Protection",
"spu": "",
"note": "",
"need_variant_image": false,
"fake_sales": 0,
"display_fake_sales": false,
"independent_seo": false,
"created_at": "2026-07-30T06:50:36Z",
"updated_at": "2026-07-30T06:51:11Z",
"tags": "",
"available": true,
"price_min": "0.5",
"price_max": "10",
"price": "0.5",
"compare_at_price": "1.00",
"compare_at_price_min": "1.00",
"compare_at_price_max": "1.00",
"url": "/products/%E8%BF%90%E8%BE%93%E4%BF%9D%E9%9A%9C%E9%99%A9?cfb=7e538b25-843c-43f1-9d8c-5fb8ab94de62&scm=relative.v14.17.18.19.20&score=0.50000025&ssp=spz",
"published_at": "2026-07-30T06:51:11Z",
"sales": 0,
"image": {
"src": "//img.staticdj.com/50fa9b8c054f4d11b0d765de5f35dd4e.png",
"width": 1254,
"height": 1254,
"alt": "",
"path": "50fa9b8c054f4d11b0d765de5f35dd4e.png",
"aspect_ratio": 1
},
"meta_title": "Shipping Protection",
"meta_description": "",
"meta_keyword": "",
"options": [
{
"id": "16d1facf-bbcd-4f4e-bf95-cb71a41875b2",
"name": "Tier",
"position": 1,
"values": [
"0.5",
"1",
"10"
]
}
],
"variants": [
{
"id": "eb84218e-5a6f-41dc-b884-c8e13307bb50",
"title": "0.5",
"weight_unit": "kg",
"inventory_quantity": 0,
"sku": "",
"barcode": "",
"position": 1,
"option1": "0.5",
"option2": "",
"option3": "",
"note": "",
"image": null,
"weight": "0.00",
"compare_at_price": "1",
"price": "0.5",
"available": true,
"available_quantity": 999999999,
"options": [
{
"name": "Tier",
"value": "0.5"
}
],
"url": "/products/Shipping Protection?variant=eb84218e-5a6f-41dc-b884-c8e13307bb50",
"off_ratio": 50,
"flashsale_info": [],
"sales": 0,
"wholesale_price": [
{
"price": "0.5",
"min_quantity": 1
}
],
"retail_price": "1"
},
{
"id": "a2bc248e-0cf2-46f4-b5ee-d6286e6ffef1",
"title": "1",
"weight_unit": "kg",
"inventory_quantity": 0,
"sku": "",
"barcode": "",
"position": 2,
"option1": "1",
"option2": "",
"option3": "",
"note": "",
"image": null,
"weight": "0.00",
"compare_at_price": "1",
"price": "1",
"available": true,
"available_quantity": 999999999,
"options": [
{
"name": "Tier",
"value": "1"
}
],
"url": "/products/Shipping Protection?variant=a2bc248e-0cf2-46f4-b5ee-d6286e6ffef1",
"off_ratio": 0,
"flashsale_info": [],
"sales": 0,
"wholesale_price": [
{
"price": "1",
"min_quantity": 1
}
],
"retail_price": "1"
},
{
"id": "66ba5a00-407d-4bd3-8334-4e60f24e0483",
"title": "10",
"weight_unit": "kg",
"inventory_quantity": 0,
"sku": "",
"barcode": "",
"position": 5,
"option1": "10",
"option2": "",
"option3": "",
"note": "",
"image": null,
"weight": "0.00",
"compare_at_price": "1",
"price": "10",
"available": true,
"available_quantity": 999999999,
"options": [
{
"name": "Tier",
"value": "10"
}
],
"url": "/products/Shipping Protection?variant=66ba5a00-407d-4bd3-8334-4e60f24e0483",
"off_ratio": 0,
"flashsale_info": [],
"sales": 0,
"wholesale_price": [
{
"price": "10",
"min_quantity": 1
}
],
"retail_price": "1"
}
],
"variants_count": 0,
"images": [
{
"src": "//img.staticdj.com/50fa9b8c054f4d11b0d765de5f35dd4e.png",
"width": 1254,
"height": 1254,
"alt": "",
"path": "50fa9b8c054f4d11b0d765de5f35dd4e.png",
"aspect_ratio": 1
}
],
"flashsale_info": [],
"off_ratio": 50,
"price_varies": true,
"ifb": "7e538b25-843c-43f1-9d8c-5fb8ab94de62",
"cfb": "7e538b25-843c-43f1-9d8c-5fb8ab94de62",
"ssp": "",
"scm": "relative.v14.17.18.19.20",
"score": 0.50000025,
"mixed_wholesale": false,
"retail_price": "1.00",
"retail_price_min": "1.00",
"retail_price_max": "1.00",
"min_price_variant": {
"id": "eb84218e-5a6f-41dc-b884-c8e13307bb50",
"title": "0.5",
"weight_unit": "kg",
"inventory_quantity": 0,
"sku": "",
"barcode": "",
"position": 1,
"option1": "0.5",
"option2": "",
"option3": "",
"note": "",
"image": null,
"weight": "0",
"compare_at_price": "1",
"price": "0.5",
"available": true,
"available_quantity": 999999999,
"options": [
{
"name": "Tier",
"value": "0.5"
}
],
"url": "/products/Shipping Protection?variant=eb84218e-5a6f-41dc-b884-c8e13307bb50",
"off_ratio": 50,
"flashsale_info": [],
"sales": 0,
"wholesale_price": [
{
"price": "0.5",
"min_quantity": 1
}
],
"retail_price": "1"
},
"product_type": "default",
"description": "",
"comment_avg_star": 0,
"comment_count": 0
}
],
"scm": "relative.v14.17.18.19.20",
"ssp": "spz"
},
"msg": "请求成功",
"state": 0
}