Created
January 19, 2022 14:57
-
-
Save aatronco/47095bc47b9b4a197744cb24cd193f3d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
$(function() { | |
fetch("/geocoder/ip", { | |
method: "get" | |
}).then(function (response) { | |
if (response.ok) { | |
return response.json().then(function(json) { | |
var country_code = json["country_code"]; | |
switch(country_code) { | |
case 'KR': | |
{% if store.currency_code != "KRW" %}Jumpseller.setCurrency('KRW');{% endif %} | |
break; | |
case 'SG': | |
{% if store.currency_code != "SGD" %}Jumpseller.setCurrency('SGD');{% endif %} | |
break; | |
case 'PL': | |
{% if store.currency_code != "PLN" %}Jumpseller.setCurrency('PLN');{% endif %} | |
break; | |
case 'CH': | |
{% if store.currency_code != "CHF" %}Jumpseller.setCurrency('CHF');{% endif %} | |
break; | |
case 'CO': | |
{% if store.currency_code != "COP" %}Jumpseller.setCurrency('COP');{% endif %} | |
break; | |
case 'MX': | |
{% if store.currency_code != "MXN" %}Jumpseller.setCurrency('MXN');{% endif %} | |
break; | |
case 'AR': | |
{% if store.currency_code != "ARS" %}Jumpseller.setCurrency('ARS');{% endif %} | |
break; | |
case 'BR': | |
{% if store.currency_code != "BRL" %}Jumpseller.setCurrency('BRL');{% endif %} | |
break; | |
case 'AU': | |
{% if store.currency_code != "AUD" %}Jumpseller.setCurrency('AUD');{% endif %} | |
break; | |
case 'CA': | |
{% if store.currency_code != "CAD" %}Jumpseller.setCurrency('CAD');{% endif %} | |
break; | |
case 'GB': | |
{% if store.currency_code != "GBP" %}Jumpseller.setCurrency('GBP');{% endif %} | |
break; | |
case 'US': | |
{% if store.currency_code != "USD" %}Jumpseller.setCurrency('USD');{% endif %} | |
break; | |
case 'BR': | |
{% if store.currency_code != "BRL" %}Jumpseller.setCurrency('BRL');{% endif %} | |
break; | |
default: | |
{% if store.currency_code != "EUR" %}Jumpseller.setCurrency('EUR');{% endif %} | |
break; | |
} | |
}); | |
} | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment