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

1 Answer 1


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.

], 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>'));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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