> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.omegatheme.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# 应用嵌入与区块添加指南

为确保应用正常运行并与您的店铺兼容，您需要启用应用嵌入功能，并在需要展示折扣的页面添加应用区块。
#### 1. 启用应用嵌入
* 进入应用**仪表盘** -> 点击**启用**按钮跳转至主题编辑界面
![](https://storage.crisp.chat/users/helpdesk/website/-/8/3/8/3/8383e5404a31c000/image_1mzdbmp.png)
* 开启**Omega Quantity**应用 -> 点击**保存**完成设置
![](https://storage.crisp.chat/users/helpdesk/website/-/8/3/8/3/8383e5404a31c000/image_1q74cm.png)
#### 2. 商品页面添加区块
* 选择商品页面模板
![](https://storage.crisp.chat/users/helpdesk/website/-/8/3/8/3/8383e5404a31c000/image_to3s4z.png)
* 点击**添加区块** -> 选择**Omega Quantity Block**应用
![](https://storage.crisp.chat/users/helpdesk/website/-/8/3/8/3/8383e5404a31c000/image_o7p6ci.png)
* 拖动至目标位置 -> 点击**保存**
![](https://storage.crisp.chat/users/helpdesk/website/-/8/3/8/3/8383e5404a31c000/image_9cavdo.png)
#### 3. 购物车页面添加区块
* 选择购物车页面模板
![](https://storage.crisp.chat/users/helpdesk/website/-/8/3/8/3/8383e5404a31c000/image_fzqsi2.png)
* 点击**添加区块** -> 选择**Omega Quantity - Cartpage**应用
![](https://storage.crisp.chat/users/helpdesk/website/-/8/3/8/3/8383e5404a31c000/image_jcjxac.png)
* 拖动至目标位置 -> 点击**保存**
![](https://storage.crisp.chat/users/helpdesk/website/-/8/3/8/3/8383e5404a31c000/image_1s83ipf.png)
#### 4. 首页添加区块
* 选择商品页面模板 -> 进入精选商品版块
![](https://storage.crisp.chat/users/helpdesk/website/-/8/3/8/3/8383e5404a31c000/image_1k4nkyz.png)
* 点击**添加区块** -> 选择**Omega Quantity - Homepage**应用
![](https://storage.crisp.chat/users/helpdesk/website/-/8/3/8/3/8383e5404a31c000/image_18ycs5g.png)
* 拖动至目标位置 -> 点击**保存**
![](https://storage.crisp.chat/users/helpdesk/website/-/8/3/8/3/8383e5404a31c000/image_sziwcy.png)
#### 5. 商品集合页面代码添加
进入主题 -> "编辑代码"
![](https://storage.crisp.chat/users/helpdesk/website/-/8/3/8/3/8383e5404a31c000/image_129k638.png)
在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>
```
![](https://storage.crisp.chat/users/helpdesk/website/-/8/3/8/3/8383e5404a31c000/image_16lqmrt.png)

#### 6. 结账页面添加区块
进入**加购交叉销售**菜单 -> 点击设置说明区域的**前往主题**按钮
![https://storage.crisp.chat/users/helpdesk/website/-/8/3/8/3/8383e5404a31c000/image_1scdo3q.png](https://storage.crisp.chat/users/helpdesk/website/-/8/3/8/3/8383e5404a31c000/image_155l6em.png)
* 系统将跳转至**主题编辑器**
* 选择目标位置 -> 添加**Pareto - Cross sell**区块
![](https://storage.crisp.chat/users/helpdesk/website/-/8/3/8/3/8383e5404a31c000/image_1klzbpu.png)
* 点击**保存**完成设置
