Magento 2 How to customize Currency symbol and format based on locale

Magento 2 How to customize Currency symbol and format based on locale

July 1, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento 2 How to customize Currency symbol and format based on locale

Customizing Currency Symbol and Format in Magento 2 Based on Locale

Currency formatting is an essential aspect of e-commerce platforms like Magento 2. By default, Magento uses the Zend Framework’s locale data to determine currency format patterns, symbols, and positions based on the store’s locale setting.

Understanding the Default Currency Configuration

Magento’s currency configuration is stored in XML files located under vendor\magento\zendframework1\library\Zend\Locale\Data. These files contain structured data for various locales, including currency specifics like symbol, display name, and formatting rules. For example:

<numbers>
    <currencyFormats numberSystem="latn">
        <currencyFormatLength>
            <currencyFormat type="standard">
                <pattern>¤ #,##0.00</pattern>
            </currencyFormat>
            <!-- ... -->
        </currencyFormatLength>
        <!-- ... -->
    </currencyFormats>
    <currencies>
        <currency type="GBP">
            <displayName>livre sterling</displayName>
            <symbol>£</symbol>
        </currency>
    </currencies>
</numbers>

Overriding the Default Currency Configuration

To override the default currency configuration, you can create a custom XML file in your theme or module and place it under app/code/Your_Module/etc/locale. This approach allows you to modify the locale data without directly editing the core files.

Here’s an example of how to create a custom fr_FR.xml file for overriding the French currency settings:

  1. Create a new directory structure: app/code/Your_Module/etc/locale/fr_FR
  2. Inside the fr_FR folder, create a new XML file (e.g., Currency.php.xml)
  3. Update the contents of Currency.php.xml with your custom currency data
<numbers>
    <currencyFormats numberSystem="latn">
        <currencyFormatLength>
            <currencyFormat type="standard">
                <pattern>¤ #,##0.00</pattern>
            </currencyFormat>
            <!-- ... -->
        </currencyFormatLength>
        <!-- ... -->
    </currencyFormats>
    <currencies>
        <currency type="EUR">
            <displayName>euro</displayName>
            <symbol>€</symbol>
        </currency>
    </currencies>
</numbers>

Applying the Custom Currency Configuration

After creating your custom XML file, Magento will automatically use it for the specified locale. To apply this change:

  1. Make sure your module is enabled and active
  2. Ensure that the store’s locale setting matches the custom locale you’ve created (e.g., French)
  3. Clear the cache to ensure Magento picks up the changes

Conclusion: Customizing Currency in Magento 2 for Enhanced Localization

By following this approach, you can easily customize currency symbols, format patterns, and positions based on your store’s locale requirements without editing core files directly.

Remember that creating a custom XML file allows you to keep the modifications separate from the core codebase, making it easier to maintain and update as needed. For more advanced customizations or when dealing with complex localization needs, consider exploring Magento’s built-in translation APIs and the Magento 2 Translation website at https://laravelcompany.com.

This method ensures that your currency formatting remains consistent across different languages and regions while keeping your store optimized for local customers’ preferences.

Magento 2 Extensions Themes Configuration

Our network