繁体   English   中英

Shopify 通过 JS 购买按钮 — 购物车显示错误的货币

[英]Shopify Buy Button via JS — Cart shows wrong currency

我已经通过Buy Button JS Library集成了 Shopify。 一切正常,但购物车显示的货币错误(显示的是 $ 而不是 €)。 我已通过 Shopify 管理仪表板(位于https://domain.myshopify.com/admin )正确设置了所有内容。 商店的主要货币设置为EUR ,并且如文档中所述,我可以通过cart.text.currency参数设置货币。 我这样做了,但它没有任何改变。 这是一个错误吗?

到目前为止我的 JS 代码:

<script src="//sdks.shopifycdn.com/buy-button/1.0.0/buybutton.js"></script>
<script>
var client = ShopifyBuy.buildClient({
  domain: 'domain.myshopify.com',
  storefrontAccessToken: '2b3xxxxxxxxjh5', // previously apiKey, now deprecated
});

ui = ShopifyBuy.UI.init(client);

ui.createComponent('product', {
  id: 23xxxxxx56,
  node: document.getElementById('my-product'),
  options: {
    "product": {
      "iframe": true
    },
    toggle: {
      "iframe": true
    },
    cart: {
      "iframe": true,
      "popup": false,
      "text": {
        "title": 'Warenkorb',
        "empty": 'Dein Warenkorb ist leer.',
        "button": 'Jetzt bestellen',
        "total": 'Gesamt',
        "currency": 'EUR',
     }
  }
});
</script>

但如附图所示,购物车仍显示$而不是

Shopify 购物车显示错误的货币


编辑

我认为这是 Shopify 方面的一个错误,但我想出了如何克服它。

我已经在我的createComponent函数中添加了moneyFormat选项,它覆盖了所有声明的货币指示。

shopifyUI.createComponent('product', {
  id: 23xxxxxx56,
  node: document.getElementById('shopify-button-buy-regular'),
  moneyFormat: '€{{amount_no_decimals}}',
  options: shopifyOptions
});

检查以确保显示购物车的主题代码符合货币设置。 您的主题可能只是因为主题代码不尊重货币而显示美元符号。 Liquid 过滤器 money_with_currency 通常用于此目的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM