From ee1df7fee0e251ae10a3cb86c05009767f6b23b7 Mon Sep 17 00:00:00 2001
From: sidharth
+ UPC {{ product.customAttributes.upc }} +
+${{ priceFormatter(product.price) }} diff --git a/src/services/util.service.js b/src/services/util.service.js index 81e91b9..6d699dc 100644 --- a/src/services/util.service.js +++ b/src/services/util.service.js @@ -700,7 +700,7 @@ export const checkEncodeURI = (str) => { } } export const priceFormatter = (price, pdp) => { - if (price != undefined) { + if (price != undefined) { price = price.toString(); let decimals = (price.split("."))[1]; if ((!Number(decimals) || isNaN(decimals)) || decimals.length == 1) //if 2 or 2.1 @@ -708,7 +708,7 @@ export const priceFormatter = (price, pdp) => { if (decimals.length == 2 && pdp) //if 2 or 2.1 return price; else if (decimals.length > 1) // if 2.34 or 2.56565 - return Number(price.match(/^-?\d+(?:\.\d{0,2})?/)[0]); + return Number(price.match(/^-?\d+(?:\.\d{0,4})?/)[0]); } }