跳转到内容

Shopify 在线客服安装

  1. 在客服应用中,打开设置 > 网站聊天窗口并复制安装代码。

    安装代码
    <!-- Click2Reply chat widget -->
    <script>
    window.__c2r = {"license":12345678};
    ;(function(w,d,n){if(w[n])return;var q=[],f=function(m){return function(){q.push([m,[].slice.call(arguments)])}};w[n]={_q:q,on:f("on"),once:f("once"),off:f("off"),call:f("call"),get:function(){throw new Error("[Click2Reply] get() is available after the widget loads")},init:function(){var s=d.createElement("script");s.async=!0;s.src="https://w.click2reply.com/w.js";d.head.appendChild(s)}};!(w.__c2r&&w.__c2r.async_init)&&w[n].init()})(window,document,"Click2Reply");
    </script>
    <noscript><a href="https://w.click2reply.com/page?license=12345678" rel="nofollow">与我们的支持团队聊天</a></noscript>
  2. 在 Shopify 后台中,打开在线商店 > 模板,然后在当前使用的模板上打开 … 菜单,选择编辑代码。

  3. 打开 layout/theme.liquid,将代码粘贴到 </body> 之前。

  4. 保存后打开您的商店,即可看到聊天按钮。

只要页面将购物车信息告知聊天窗口,客服就能在聊天旁边看到顾客的购物车。请在 theme.liquid 中的安装代码之后添加以下代码,Shopify 会自动填入相应的值。call 在聊天窗口加载之前也可以使用:调用会先等待,待聊天窗口加载完成后再执行。

<script>
Click2Reply.call("set_cart", {
value: {{ cart.total_price | divided_by: 100.0 }},
currency: {{ cart.currency.iso_code | json }},
items: {{ cart.item_count }}
});
</script>

value 以该币种的主单位计,因此 19.99 USD 就写作 19.99。

客户登录后,传入其姓名和邮箱,客服就无需再询问:

{% if customer %}
<script>
Click2Reply.call("set_customer_name", {{ customer.name | json }});
Click2Reply.call("set_customer_email", {{ customer.email | json }});
</script>
{% endif %}