Rounding solution that can be used with new native currency converter tool

Hi,
I’m delighted that Wix have launched the new currency converter tool but my client is looking for a specific rounded value to appear depending on client location. I can figure that bit out but haven’t had any luck finding a work around to get the €, $ £ etc. amounts to round up automatically i.e. £50.23 would appear as £50 and $100.78 would appear at $101.00 when converted from euro.

Has anyone found a way to do this or a third party fix?

Below my rounding function to do this. Call it, for instance, like

let numRounded = fnRoundAmountMultiples(50.23, 1, "arith");
 

Expected result : 50

The function lets you choose a rounding method. Example:
up: 50.23 rounded on 1 would be 51, 100.78 would be 101
down: 50.23 rounded on 1 would be 50, 100.78 would be 100
arith : 50.23 rounded on 1 would be 50, 100.78 would be 101

function fnRoundAmountMultiples(numAmountIn, numRoundOn, strRoundType) {
    let numRoundedAmount = 0;
    let numDiv = numAmountIn / numRoundOn;
    let numMod = numAmountIn % numRoundOn; // calc modulo
    if (numMod === 0) return numAmountIn;
    let numModDivByUnit = numMod / numRoundOn; // devide mod by amount to round on
    let boolIsgeHalf = numModDivByUnit >= 0.5; // is it greater or equal than 0.5? Then Method is up for arithmetical
    let numBaseUp = Math.round(numDiv + 0.5);
    let numBaseDown = Math.round(numDiv - 0.5);
    let numRoundedUp = numBaseUp * numRoundOn;
    let numRoundedDown = numBaseDown * numRoundOn;
    switch (strRoundType) {
    case "up": // up
        return numRoundedUp;
    case "down": // down
        return numRoundedDown;
    case "arith": // arithmetical
        if (boolIsgeHalf) {
            return numRoundedUp;
        } else return numRoundedDown;
    }

}

Thats great, I’ll try that, thank you so much.

Hello, I’m dealing with a similar issue. I want to synchronize the client’s browser language with the currency. However, the code I created did not meet what I wanted. The code you used might solve my problem in a different way. I would greatly appreciate it if you would be kind enough to share this code sample with me. Good work.

Hi, I couldn’t get it to work in the end I’m afraid

Guys, that code works, I use it myself. If it does not work for you, show us your code, only then can we help you.

Hey, i tried pasting this in the masterpage.js and in the store pages, it wont work for me… but im new to this so maybe im missing something?