Developer forum

Forum » Rapido » Change currency when delivery country is changed

Change currency when delivery country is changed

Martin Grønbekk Moen
Martin Grønbekk Moen
Reply

We are using DW 9.4.10 with Rapido 2.0 and would like to know if it is possible to make the currency change automatically if the delivery country change.
Are there some kind of setup to make this happen, or do we have to make a code change?


Replies

 
Nicolai Pedersen
Reply

Hi Martin

In website settings, enable custom js. See dump.

Then add som js that adds an event listener to the dropdown of delivery countris and add a bit of logic, i.e. like this (not verified code):

var deliveryCountry = document.getElementById("EcomOrderDeliveryCountry");

deliveryCountry.addEventListener("change", function() {
    if(deliveryCountry.value == "Denmark")
    {
        changeCurrency();
    }
});

function changeCurrency() {
    // ... Code to add item here
    location = location + "&currencycode=dkk";
}
Capture.PNG

 

You must be logged in to post in the forum