簡體   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