应用嵌入与区块添加指南
为确保应用正常运行并与您的店铺兼容,您需要启用应用嵌入功能,并在需要展示折扣的页面添加应用区块。
1. 启用应用嵌入
- 进入应用仪表盘 -> 点击启用按钮跳转至主题编辑界面
- 开启Omega Quantity应用 -> 点击保存完成设置
2. 商品页面添加区块
- 选择商品页面模板
- 点击添加区块 -> 选择Omega Quantity Block应用
- 拖动至目标位置 -> 点击保存
3. 购物车页面添加区块
- 选择购物车页面模板
- 点击添加区块 -> 选择Omega Quantity - Cartpage应用
- 拖动至目标位置 -> 点击保存
4. 首页添加区块
- 选择商品页面模板 -> 进入精选商品版块
- 点击添加区块 -> 选择Omega Quantity - Homepage应用
- 拖动至目标位置 -> 点击保存
5. 商品集合页面代码添加
进入主题 -> "编辑代码"
在collection.liquid或card-product.liquid文件中目标位置添加以下代码:
liquid
Copy
Download
{% assign result_collection = "" %}
{% for collection in card_product.collections %}
{% if forloop.first == false %}
{% assign result_collection = result_collection | append: "," %}
{% endif %}
{% assign result_collection = result_collection | append: collection.id %}
{% endfor %}
<div class="omg-discount-notification" data-product-id="{{ card_product.id }}" data-collections="{{ result_collection }}"></div>
<script>
if (typeof window.omgProductList === "undefined") {
window.omgProductList = [];
}
(function(){
const product = {
id: {{ card_product.id | json }},
title: {{ card_product.title | json }},
handle: {{ card_product.handle | json }},
variants: [
{% for variant in card_product.variants %}
{
id: {{ variant.id | json }},
title: {{ variant.title | json }},
price: {{ variant.price | json }},
available: {{ variant.available | json }}
}
{% unless forloop.last %},{% endunless %}
{% endfor %}
]
};
const productExists = window.omgProductList.some(p => p.id === product.id);
if (!productExists) {
window.omgProductList.push(product);
}
})();
</script>
6. 结账页面添加区块
进入加购交叉销售菜单 -> 点击设置说明区域的前往主题按钮
- 系统将跳转至主题编辑器
- 选择目标位置 -> 添加Pareto - Cross sell区块
- 点击保存完成设置
更新于: 24/06/2025
谢谢!