We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

    When you pass price value phtml to js , you need to display price with currency from js.

    Use ‘Magento_Catalog/js/price-utils’ priceUtils Js object in your custom javascript file to set currency to price.

    Then add getFormattedPrice() function in your file to display currency symbol with price from javascript.

    define([
        'ko',
        'Magento_Catalog/js/price-utils'
    ], function (
        ko,
        priceUtils
    ) {
        'use strict';
        return {
            /**
             * Formats the price with currency format
             *
             * @param {number}
             * @return {string}
             */
            getFormattedPrice: function (price) {
                var priceFormat = {
                    decimalSymbol: '.',
                    groupLength: 3,
                    groupSymbol: ",",
                    integerRequired: false,
                    pattern: "₹%s",
                    precision: 2,
                    requiredPrecision: 2
                };
                return priceUtils.formatPrice(price, priceFormat);
            }
        }
    });

     

    Fill the below form if you need any Magento relate help/advise/consulting.

    With Only Agency that provides a 24/7 emergency support.

      Get a Free Quote