Magento remove decimal points from the price

Magento remove decimal points from the price

In this post we will show you Magento remove decimal points from the price, hear for Magento remove decimal points from the price we will give you demo and example for implement.

How to Magento remove decimal points in price of product

we will show you How to remove decimal points in price of product magento. For Magento remove decimal points from the price you need this code.

Magento remove decimal points from the price
Magento remove decimal points from the price

Price of product is : 116,00 $ => 116 $
Price of product is : 116.00 $ => 116 $
Price of product is : 15,116.00 => 15,116

In order to remove decimal points in price of product magento, we need to custom some code.

Go to this file : code/core/Mage/Directory/Model/Currency.php
copy this file with past at this location code/local/Mage/Directory/Model/.

Open code/local/Mage/Directory/Model/Currency.php Find the following code at line number 195 :-

Find this code:

// change this code
public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)
{
return $this->formatPrecision($price, 2, $options, $includeContainer, $addBrackets);
}

and replaced it by this code :

// add this code
public function format($price, $options=array(), $includeContainer = true, $addBrackets = false)
{
return $this->formatPrecision($price, 0 , $options, $includeContainer, $addBrackets);
}

Clear your caches and it’s done. Cheers

Hope this code and post will helped you for implement Magento remove decimal points from the price. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve onlincode. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs onlincode.org

Leave a Comment

Your email address will not be published. Required fields are marked *

4  +  5  =  

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US