Solved

How to resolve multi-currency issue in Ajax cart?

smit-brightness
Shopify Partner
3 1 0

I've been working on a store that has Shopify markets enabled. Default one is Swiss while others are Germany and Austria. Default shop currency is CHF, while other markets have Euro currency

 

The issue: The issue that when I add any product from non-Swiss market using ajax / fetch, the response has CHF as currency (even if I pass locale aware URL).

 
This issue is present even when fetching cart using console (image: https://prnt.sc/Rx7_-2gtFqFv)
 
Any kind of help / suggestion / guidance is appreciated. 
 
Thank you!
Accepted Solution (1)

smit-brightness
Shopify Partner
3 1 0

This is an accepted solution.

To anyone who has similar issue, check the network logs for the requests your theme or any other app might be making. I found that my theme had a local delivery functionality built-in, which was changing the currency to native one - causing this issue.

 

Hope that helps. ✌️

View solution in original post

Replies 4 (4)

andrija_obradov
Shopify Partner
9 0 1

Hello,

Did you try to use a VPN choose Germany or Austria, and then try to run the script? It may work. If this happens the problem is likely with your currency switcher app. 
Also, you can type in the console 

console.log("Active currency: " Shopify.currency.active);

And you will get the current active currency

 

smit-brightness
Shopify Partner
3 1 0

Hi @andrija_obradov , Yes, I've tried everything. The active currency is successfully set to Euro. I've included the same in my screenshot here:  https://prnt.sc/Rx7_-2gtFqFv

The issue is - even if I add the product using market specific URL  (`/de-de/add.js`) or fetch cart data (with `/de-de/cart.js`), the response is sometimes in Euro but most of the times it is in CHF. Everything works perfect when reloading the page - all prices are in Euro even in cart dropdown.. But when a new product is added to the cart, it changes to CHF because of wrong response.

 

Maybe this can help understand the issue.

https://www.loom.com/share/937eeab4336746e988cbe7638f19f00a

tal32
Tourist
5 0 2

Did you ever solve this issue?

smit-brightness
Shopify Partner
3 1 0

This is an accepted solution.

To anyone who has similar issue, check the network logs for the requests your theme or any other app might be making. I found that my theme had a local delivery functionality built-in, which was changing the currency to native one - causing this issue.

 

Hope that helps. ✌️