Auto currency switching with Google Shopping

User01
New Member
4 0 0

I'm looking for a way to automatically switch currency to GBP for users shopping in the UK with Google Shopping without reloading the page. The reason for this is due to the fact that any merchant feed listing that enters Google Shopping in a specific currency (for example GBP), must always automatically have that currency upon clickthrough regardless of the location the website is viewed in (Confirmed by Google Shopping).

 

This means that if your default store currency isn't GBP then google will flag your merchant listing for price discrepancy due to the fact all of the available automatic currency switcher apps available for Shopify first render the page in the default store currency prior to changing it and storing the country code in the cart_currency cookie.

 

To do this I'm thinking of initiating javascript to read the google shopping query string that contains the required currency, the below is an example of what the google shopping link to a product includes: 

 

www.ecommercesite.com/product-title?variant=39645827232&currency=GBP&utm_source=google&utm_medium=organic&utm_campaign=United%20Kingdom&utm_content=product$20title

 

 

so essentially I want to run a script that checks for a query string, finds currency, and sets the cart_currency cookie to GBP prior to the page loading, if the query string does not exist or does not contain a currency then it should run the below script which will change the currency based on IP location:

 

  <script>
	window.mlvedaShopCurrency = "{{ shop.currency }}";
	window.shopCurrency = "{{ shop.currency }}";
	window.supported_currencies = "{{ settings.mlvedaACS_supportedCurrencies }}";
  </script>

 

 

So basically it's checking "are you visiting from google shopping?" if yes "find currency from query string and set value in cart_currency cookie", if no "run automatic currency switcher app js"

 

Has anyone tried this before? essentially this should allow for automatic currency switching that is super fast if the person is visiting from Google Shopping, it also means that the price will always match the listing as the currency is passed directly through the query string directly from merchant center. Meaning I could set up a USD Merchant Center account and as long as my payment methods include USD the price and currency should match the merchant listing (USD).

If anyone can help out with the code that would be amazing as I think this can help a lot of businesses using their one site for global sales.

Replies 0 (0)