Skip to content

Conversation

@dverkade
Copy link

In the current situation it loads all the currencies which are available in the installation. However it should process only the currency codes which are actually available for the specific store view.

Current output of the tracking template:

convert_currency_from_iso: function(price, currency_iso){
  const ex_rates = JSON.parse('{"AZN":false,"AZM":false,"AFN":false,"ALL":false,"DZD":false,"AOA":false,"ARS":false,"AMD":false,"AWG":false,"AUD":false,"BSD":false,"BHD":false,"BDT":false,"BBD":false,"BYN":false,"BZD":false,"BMD":false,"BTN":false,"BOB":false,"BAM":false,"BWP":false,"BRL":false,"GBP":false,"BND":false,"BGN":false,"BUK":false,"BIF":false,"KHR":false,"CAD":false,"CVE":false,"CZK":false,"KYD":false,"CLP":false,"CNY":false,"COP":false,"KMF":false,"CDF":false,"CRC":false,"HRK":false,"CUP":false,"DKK":false,"DJF":false,"DOP":false,"XCD":false,"EGP":false,"SVC":false,"GQE":false,"ERN":false,"EEK":false,"ETB":false,"EUR":"0.098496000000","FKP":false,"FJD":false,"GMD":false,"GEK":false,"GEL":false,"GHS":false,"GIP":false,"GTQ":false,"GNF":false,"GYD":false,"HTG":false,"HNL":false,"HKD":false,"HUF":false,"ISK":false,"INR":false,"IDR":false,"IRR":false,"IQD":false,"ILS":false,"JMD":false,"JPY":false,"JOD":false,"KZT":false,"KES":false,"KWD":false,"KGS":false,"LAK":false,"LVL":false,"LBP":false,"LSL":false,"LRD":false,"LYD":false,"LTL":false,"MOP":false,"MKD":false,"MGA":false,"MWK":false,"MYR":false,"MVR":false,"LSM":false,"MRO":false,"MUR":false,"MXN":false,"MDL":false,"MNT":false,"MAD":false,"MZN":false,"MMK":false,"NAD":false,"NPR":false,"ANG":false,"TRL":false,"TRY":false,"NZD":false,"NIC":false,"NIO":false,"NGN":false,"KPW":false,"NOK":false,"OMR":false,"PKR":false,"PAB":false,"PGK":false,"PYG":false,"PEN":false,"PHP":false,"PLN":false,"QAR":false,"RHD":false,"RON":false,"ROL":false,"RUB":false,"RWF":false,"SHP":false,"STD":false,"SAR":false,"RSD":false,"SCR":false,"SLL":false,"SGD":false,"SKK":false,"SBD":false,"SOS":false,"ZAR":false,"KRW":false,"LKR":false,"SDG":false,"SRD":false,"SZL":false,"SEK":1,"CHF":false,"SYP":false,"TWD":false,"TJS":false,"TZS":false,"THB":false,"TOP":false,"TTD":false,"TND":false,"TMM":false,"USD":false,"UGX":false,"UAH":false,"AED":false,"UYU":false,"UZS":false,"VUV":false,"VEB":false,"VEF":false,"VND":false,"CHE":false,"CHW":false,"XOF":false,"XPF":false,"WST":false,"YER":false,"ZMK":false,"ZWD":false}');
  if(ex_rates[currency_iso] !== undefined){
  return price * ex_rates[currency_iso];
  } else {
  return price;
  }
  }

After this change it will look like this:

convert_currency_from_iso: function(price, currency_iso){
  const ex_rates = JSON.parse('{"EUR":1}');
  if(ex_rates[currency_iso] !== undefined){
  return price * ex_rates[currency_iso];
  } else {
  return price;
  }
}

In the current situation it loads all the currencies which are available in the installation. However it should process only the currency codes which are actually available for the specific store view.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant