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
  • You need it in your html file? – aravind Aug 30 at 9:39
  • Post your code, where you displayed your custom price. – Ranganathan Aug 30 at 9:42
  • @aravind Yes in html file. – Himanshu Aug 30 at 9:43
  • @Ranganathan updated the code – Himanshu Aug 30 at 9:45
  • Did you added a component js for the html file? – Ranganathan Aug 30 at 9:51

Your Answer

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

Browse other questions tagged or ask your own question.