I have a Custom Product Attribute named as 'ship_cost' with an input type 'text field'. While putting a value on back-end, it automatically adds four extra zeros after the decimal point.
I want this price in 'Rs. 45.00' format but currently it is showing as 'Rs. 45.0000'.
I have not worked with Magento for a long time, basically, I am a newbie.
There's a few ways to do this.
A simple fix would be to just use the number_format()
function:
<?php
$_product = $this->getProduct();
$prodShipCost = $_product->getData('ship_cost'); // Or however you want to get the attribute values
$priceFormatted = number_format($prodShipCost, 2, '.', '');
echo $priceFormatted;
?>