1

I want to replace the comma in the price with the currency symbol to display something like this .price format

0

I have below a javascript solution that may help you. It will only work with currency where the currency code is before the value. I have it working on my local environment so it should definitely push you a bit further.

define([
    'jquery'
], function ($) {

    $('.price').each(function (index, elt) {
        var price = $(elt).html();
        var currency = price.substring(0,1);
        var value = price.substring(1);

        $(elt).html(value.replace('.', '<sup>'+currency+'</sup>'));
    });
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.