0

I need to format my custom price on product detail page.

I've already refer this KO Template and Using Javascript question but both have same solution of using quote.getPriceFormat() for formatting.

But in my case on product detail page quote object is not available so how can I format the price with a local currency symbol.

var ko = require('priceUtils');
ko.formatPrice(10,{}); //Price format Object{}
output : "10,00" // expected result $10.00
6
  • You need it in your html file?
    – aravind
    Commented Aug 30, 2019 at 9:39
  • Post your code, where you displayed your custom price. Commented Aug 30, 2019 at 9:42
  • @aravind Yes in html file.
    – Himanshu
    Commented Aug 30, 2019 at 9:43
  • @Ranganathan updated the code
    – Himanshu
    Commented Aug 30, 2019 at 9:45
  • Did you added a component js for the html file? Commented Aug 30, 2019 at 9:51

0

Your Answer

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

Browse other questions tagged or ask your own question.