这段代码来自Gorgias应用程序,我想知道是否有一种基于Shopify存储语言(shop.locale或url (fr,en))构建规则的方法。
applicationID确定服务台的语言。因此,这是唯一需要根据规则改变的受影响的部分。这是仅限英文livechat的代码。法语applicationID是17741。
你能帮我建立这个规则吗?
<!--Gorgias Chat Widget Start-->
<script id="gorgias-chat-widget-install-v2" src="https://config.gorgias.chat/gorgias-chat-bundle-loader.js?applicationId=17634"></script>
<script id="gorgias-chat-shopify-install">!function(_){_.SHOPIFY_PERMANENT_DOMAIN="{{shop.permanent_domain}}",_.SHOPIFY_CUSTOMER_ID="{{customer.id}}",_.SHOPIFY_CUSTOMER_EMAIL="{{customer.email}}"}(window||{});</script>
<!--Gorgias Chat Widget End--> 发布于 2022-06-13 03:57:34
使用Shopify液体request.locale确定当前语言,并根据更新后的应用程序ID。

使用类似
{% assign appID = '' %} // you default ID
{% if request.locale.name == '' %}
{% assign appID = '' %} // language based ID
{% endif %}然后
<!--Gorgias Chat Widget Start-->
<script id="gorgias-chat-widget-install-v2" src="https://config.gorgias.chat/gorgias-chat-bundle-loader.js?applicationId={{appID}}"></script>
<script id="gorgias-chat-shopify-install">!function(_){_.SHOPIFY_PERMANENT_DOMAIN="{{shop.permanent_domain}}",_.SHOPIFY_CUSTOMER_ID="{{customer.id}}",_.SHOPIFY_CUSTOMER_EMAIL="{{customer.email}}"}(window||{});</script>
<!--Gorgias Chat Widget End--> 如果有一种以上的语言,然后使用case从液体。您可以阅读更多关于案例和request.locale的内容。
https://stackoverflow.com/questions/72596152
复制相似问题