How To Remove Decimal From Magento-1 Prices?

How To Remove Decimal From Magento-1 Prices?

August 18, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How To Remove Decimal From Magento-1 Prices?

Removing Decimal From Magento-1 Prices: A Comprehensive Guide

Introduction

In this guide, we’ll solve the common issue of removing decimal points from prices in Magento-1 without losing currency symbols. We’ll provide you with an accurate and practical solution that you can implement directly on your store.

Understanding The Currency Formatting System

Magento uses Zend Locale library to format currencies according to the locale settings of each store view. In English stores, this formatting is defined in /lib/Zend/Locale/Data/en.xml.

The currencyFormats section contains patterns for different currency formats:

<currencyFormats>
    <currencyFormatLength>
        <currencyFormat>
            <pattern>#,##0.00 ¤</pattern>
        </currencyFormat>
    </currencyFormatLength>
</currencyFormats>

In this pattern:

  • #,##0.00: The number format is 0 decimals with thousands separators.
  • ¤: The currency symbol ($ in English stores) appears after the number.

Incorrect Approach: Removing Decimal Point

You attempted to remove the decimal point by changing the pattern to:

<pattern>#,##0 ¤</pattern>

This removes the .00 from the format but also removes the currency symbol because it’s tied to the ¤ character in the original pattern.

The Correct Approach: Re-positioning Currency Symbol

To remove the decimal point and keep the currency symbol on the right side, you must use the following pattern:

<pattern>#,##0 ¤</pattern>

This keeps the number format at 0 decimals with thousands separators but moves the currency symbol to the right of the number.

However, as you noticed, this places the currency symbol on the left side in the frontend. This is because Magento doesn’t support moving the currency symbol to the right by default.

The Final Solution: Custom Currency Format

To achieve your desired format (1,321 $ without a decimal point), we need to create a custom currency format using an observer and the Mage_Core_Model_Store class.

Here’s a step-by-step guide:

1. Create a Custom Module

Create a new Magento module in app/code/local/YourCompany/CustomCurrency/ with necessary files (config.xml, etc.xml).

2. Add an Observer to core_price_indexer_update_all event

In your config.xml:

<events>
    <core_price_indexer_update_all>
        <observers>
            <yourcompany_customcurrency_observer>
                <type>singleton</type>
                <class>YourCompany_CustomCurrency_Model_Observer</class>
                <method>customCurrencyFormat</method>
            </yourcompany_customcurrency_observer>
        </observers>
    </core_price_indexer_update_all>
</events>

3. Create the Observer Class

Create app/code/local/YourCompany/CustomCurrency/Model/Observer.php:

class YourCompany_CustomCurrency_Model_Observer {
    public function customCurrencyFormat($observer) {
        $store = Mage::getSingleton('core/store');
        $store->setConfig(Mage_Directory_Model_Dir::XML_PATH_CURRENCY_FORMAT, '¤ #,##0');
        return $this;
    }
}

This observer changes the currency format for all stores during the price indexer update.

4. Clear Cache and Re-index

After saving your module configuration in Magento’s backend (System > Configuration > Currency Setup), clear cache and re-index:

  • Cache Management: Flush all cache types
  • Index Management: Reindex all indexes

Conclusion

In this guide, we’ve walked through the common issue of removing decimal points from prices in Magento-1 while keeping currency symbols on the right side. We’ve provided a practical solution that involves creating a custom module and observer to change the currency format at runtime.

Remember to always backup your files before making changes, especially when working with core files or observers.

If you found this guide helpful, please share it with your developer community. For more advanced Magento tips and tricks, check out our blog at Laravel Company.

Configuration Pricing Errors

Our network