---
title: "How to Add Custom Currency to Magento 2?"
url: "https://magecomp.com/blog/add-custom-currency-magento-2/"
date: "2024-05-24T14:46:38+00:00"
modified: "2025-02-12T10:41:22+00:00"
author:
  name: "Dhiren Vasoya"
  url: "https://magecomp.com/"
categories:
  - "How To"
  - "Magento 2"
word_count: 880
reading_time: "5 min read"
summary: "Hello Magento Friends,"
description: "Learn how to add a custom currency to your Magento 2 store with this comprehensive guide."
keywords: "How To, Magento 2"
language: "en"
schema_type: "Article"
related_posts:
  - title: "To Make the Zip/Postal Code Optional for Checkout in Magento 2, You can Follow These Steps:"
    url: "https://magecomp.com/blog/how-to-make-zip-postal-code-optional-for-checkout-in-magento-2/"
  - title: "How to Display Star Rating into Magento 2 Admin Grid?"
    url: "https://magecomp.com/blog/display-star-rating-into-magento-2-admin-grid/"
  - title: "How to Create Indian GST Tax Rule in Magento 2?"
    url: "https://magecomp.com/blog/create-indian-gst-tax-rule-magento-2/"
---

# How to Add Custom Currency to Magento 2?

_Published: May 24, 2024_  
_Author: Dhiren Vasoya_  

![How to Add Custom Currency to Magento 2](https://magecomp.com/blog/wp-content/uploads/2024/05/How-to-Add-Custom-Currency-to-Magento-2-1024x512.webp)

**Hello Magento Friends,**

In this blog, we will learn about How to Add Custom Currency to Magento 2.
Magento 2 is a powerful e-commerce platform that provides a plethora of features for managing online stores. One such feature is the ability to handle multiple currencies, which is crucial for businesses operating in international markets. Merchants can also [**add a currency switcher**](https://magecomp.com/magento-2-geoip-currency-switcher.html) in store frontend to improve user’s shopping experience.
While Magento 2 supports a variety of currencies out of the box, there may be instances where you need to add a custom currency that isn’t natively supported. This could be for a loyalty program, a custom reward system, or even a unique virtual currency.
[![hyva theme development](https://magecomp.com/blog/wp-content/uploads/2025/02/hyva-theme-development-CTA-2.webp)](https://magecomp.com/services/hyva-theme-development/)

This guide will walk you through the steps to add a custom currency to your Magento 2 store.
## Steps to Add Custom Currency to Magento 2:
**Step 1:** Create a **registration.php** file at the following path.
**/app/code/Vendor/Extension/registration.php**

Now, add the below given code
```
<?php

MagentoFrameworkComponentComponentRegistrar::register(
    MagentoFrameworkComponentComponentRegistrar::MODULE,
    'Vendor_Extension',
    __DIR__
);
require_once(__DIR__ . '/Override/Currencybundle.php');
```

**Step 2:** Create **Currencybundle.php** file at the below path.
**/app/code/Vendor/Extension/Override/Currencybundle.php**

Then add the code as follows
```
<?php
namespace MagentoFrameworkLocaleBundle;
class Currencybundle extends DataBundle
{
    /**
     * @var string
     */
    protected $path = 'ICUDATA-curr';

    /**
     * @var string
     */
    public function toArray($bundle)
    {
        $aux = [];
        foreach ($bundle as $k => $v) {
            $aux[$k] = is_object($v) ? $this->toArray($v) : $v;
        }
        return $aux;
    }

    /**
     * Method to get currency bundle
     *
     * @param string $locale
     * @return array
     */
    public function get($locale)
    {
        $bundle = parent::get($locale);
        $bundleAsArray = $this->toArray($bundle);
        $bundleAsArray['Currencies']['BTC'] = [
            'BTC',
            'Bitcoin',
        ];
        $bundleAsArray['CurrencyPlurals']['BTC'] = [
            'one' => 'Bitcoin',
            'other' => 'Bitcoin',
        ];
        return $bundleAsArray;
    }
}
```

**Step 3:** Create **di.xml** file at the below-mentioned file path.
**/app/code/Vendor/Extension/etc/di.xml**

After that add the following piece of code
```
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

    <type name="MagentoFrameworkLocaleConfig">
        <plugin name="crypto_locale" type="VendorExtensionPluginLocaleconfig" sortOrder="1" />
    </type>

    <type name="MagentoFrameworkAppConfig">
        <plugin name="crypto_config" type="VendorExtensionPluginConfigplugin" sortOrder="1" />
    </type>

    <type name="MagentoFrameworkPricingRenderAmount">
        <plugin name="crypto_framework_pricing_render_amount" type="VendorExtensionPluginFrameworkPricingRenderAmount" />
    </type>

    <type name="MagentoDirectoryModelPricecurrency">
        <plugin name="crypto_directory_model_pricecurrency" type="VendorExtensionPluginDirectoryModelPricecurrency" />
    </type>

    <type name="MagentoFrameworkLocaleFormat">
        <plugin name="crypto_framework_locale_format" type="VendorExtensionPluginFrameworkLocaleFormat" />
    </type>
</config>
```

[![Magento version upgrade](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Version-Upgrade-CTA-1.webp)](https://magecomp.com/services/magento-upgrade-services/)

**Step 4:** Create **Localeconfig.php** file at the below-given file path.
**/app/code/Vendor/Extension/Plugin/Localeconfig.php**

Now, include the following code snippet
```
<?php
namespace VendorExtensionPlugin;
class Localeconfig
{
    /**
     * After get allowed currencies
     *
     * @param MagentoFrameworkLocaleConfig $config
     * @param array $currencies
     * @return array
     */
    public function afterGetAllowedCurrencies(MagentoFrameworkLocaleConfig $config, $currencies)
    {
        return array_merge($currencies, ['BTC']);
    }
}
```

**Step 5:** Create **Configplugin.php** file at the path given below.
**/app/code/Vendor/Extension/Plugin/Configplugin.php**

Then after, add the below code
```
<?php
namespace VendorExtensionPlugin;

class Configplugin
{
    /**
     * After get currency config value
     *
     * @param MagentoFrameworkAppConfigScopeConfigInterface $subject
     * @param string $result
     * @param string $path
     * @param string $scope
     * @param string $scopeCode
     * @return string
     */
    public function afterGetValue(MagentoFrameworkAppConfigScopeConfigInterface $subject,
        $result,
        $path = null,
        $scope = MagentoFrameworkAppConfigScopeConfigInterface::SCOPE_TYPE_DEFAULT,
        $scopeCode = null
    )
    {
        if ($path === 'system/currency/installed') {
            return $result . ',' . 'BTC';
        }
        return $result;
    }
}
```

**Step 6:** Create **Amount.php** file at the following path.
**/app/code/Vendor/Extension/Plugin/Framework/Pricing/Render/Amount.php**

Now, include the following code
```
<?php
namespace VendorExtensionPluginFrameworkPricingRender;

use MagentoFrameworkPricingPriceCurrencyInterface;

class Amount
{
  public function beforeFormatCurrency(
    $subject,
    $amount,
    $includeContainer = true,
    $precision = PriceCurrencyInterface::DEFAULT_PRECISION
  ) {
    return [$amount, $includeContainer, 4];
  }
}
```

**Step 7:** Create **Pricecurrency.php** file at the below-mentioned path.
**/app/code/Vendor/Extension/Plugin/Directory/Model/Pricecurrency.php**

And then add the code as given below
```
<?php
namespace VendorExtensionPluginDirectoryModel;

class Pricecurrency
{
  public function beforeConvertAndRound(
    $subject,
    $amount,
    $scope = null,
    $currency = null,
    $precision = MagentoDirectoryModelPriceCurrency::DEFAULT_PRECISION
  ) {
    return [$amount, $scope, $currency, 4];
  }

  public function beforeFormat(
    $subject,
    $amount,
    $includeContainer = true,
    $precision = MagentoDirectoryModelPriceCurrency::DEFAULT_PRECISION,
    $scope = null,
    $currency = null
  ) {
    return [$amount, $includeContainer, 4, $scope, $currency];
  }
}
```

**Step 8:** Create **Format.php** file at the path given below.
**/app/code/Vendor/Extension/Plugin/Framework/Locale/Format.php**

And add the code as follows
```
<?php
namespace VendorExtensionPluginFrameworkLocale;

class Format
{
  public function afterGetPriceFormat($subject, $result) {
    $result['precision'] = 4;
    $result['requiredPrecision'] = 4;

    return $result;
  }
}
```

[![Magento 2 Speed & Performance Optimization Services](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Speed-Performance-Optimization-Services-CTA-1.webp)](https://magecomp.com/magento-performance-optimization.html)

**Output:**

You can see that your custom currency has been added to the backend currency setup configuration.
![backend custom currency](https://magecomp.com/blog/wp-content/uploads/2024/05/backend-custom-currency.png)

The custom currency will be displayed on the frontend product page.
![product page custom currency](https://magecomp.com/blog/wp-content/uploads/2024/05/product-page-custom-currency.png)

The custom currency will also be displayed on the frontend category page.
![category page custom currency](https://magecomp.com/blog/wp-content/uploads/2024/05/category-page-custom-currency.png)

## Conclusion:
By following this guide, you can extend the capabilities of your Magento 2 store to support any custom currency, enhancing your store’s flexibility and catering to a broader audience.
Share the tutorial with your friends and stay in touch with us for more such Magento 2 custom solutions.
**Happy Coding!**


---

_View the original post at: [https://magecomp.com/blog/add-custom-currency-magento-2/](https://magecomp.com/blog/add-custom-currency-magento-2/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-09-09 06:54:06 UTC_  
