I've displayed item's price (both old price and new price) using this code,
<?php echo $_item->getProduct()->getPrice(); ?>
But when I see the page, it displays price with 4 decimal numbers, like 150.0000
I need to change number of decimals after the
. to be two. like 15.00
How can I do this?
I'm okay with however getting formatted number, when
$_item->getProduct()->getPrice(); gives 15.0000 I need to change it into 15.00 however way possible.
Can anybody help me?
- NOTE -
php way to format the numbers.
<?php $oldprice = $_item->getProduct()->getPrice(); echo number_format($oldprice, 2, ".", ","); ?>
But the problem is, I've to put this everywhere I need to change the format