How to change price format in Magento 1

How to change price format in Magento 1

October 11, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to change price format in Magento 1

Changing Price Format in Magento 1

Hello developers! Today we’re going to tackle a common issue faced by many merchants using Magento 1 - changing the price format displayed on the frontend.

Understanding the Current Issue

Many stores, out of the box, display prices with a comma as the thousand separator and a period as the decimal separator. For example, the price $1,114.50 might be shown as (US$1.114,50).

While this format may be standard in some countries, it’s not universally accepted. In many regions, including the United States, prices are commonly displayed without a comma for thousands and with a period or space as the decimal separator.

The Goal: Changing to a Different Price Format

Our task is to modify Magento 1 to display prices in the following format: (US$1,114.50).

Step-by-Step Solution

1. Locate the Responsible File

The price formatting logic resides within the app/code/core/Mage/Directory/Model/Currency.php file.

app/code/core/Mage/Directory/Model/Currency.php

2. Identify the Relevant Function

Scroll down to the format() function around line 170:

public function format($value, $includeCurrencyCode = false)
{
    // Rest of the code
}

This is where we’ll make our modifications.

3. Make the Necessary Changes

Open the file in your text editor or IDE and locate this line:

$formattedValue = number_format($value * 1, $this->getPrecision(), $this->getPrecisionSeparator(), $this->getThousandSeparator());

We need to swap the precision and thousand_separator values. In Magento 1, these are both set to commas by default.

$formattedValue = number_format($value * 1, $this->getThousandSeparator(), $this->getPrecision(), $this->getPrecisionSeparator());

4. Save and Test the Changes

Save your edited file and refresh your Magento frontend. The prices should now be formatted correctly.

Best Practices for Handling Price Formatting

While this manual solution works, it’s not recommended as it modifies core files which could be overwritten during updates. A better approach is to use a custom module or extension that hooks into the price formatting process.

For instance, you might create an observer on the controller_action_predispatch_catalog_product_view event and override the price formatting logic there. This ensures your changes persist across updates.

Conclusion: Changing Price Format in Magento 1

We’ve successfully demonstrated how to change the price format in Magento 1 by directly editing a core file. However, I strongly recommend using a custom module or extension for this purpose instead of modifying core files directly.

Remember, any changes to core files should be done with extreme caution as they can cause compatibility issues and may be overwritten during updates.

For more information on creating custom modules in Magento 1, I invite you to explore our comprehensive guide: Creating Custom Modules in Magento.

This article will provide a deeper dive into the process of extending and modifying Magento’s core functionality safely and effectively.

Happy coding!

Magento 1 API Pricing Errors

Our network