Home » Magento8 November 2010

Magento: Convert Price from Current Currency to Base Currency and vice-versa

Here is a quick code to convert price amount from current currency of the shop to base currency. This is applicable when you have a multiple currency shop.

From the code below, you can convert any currency you desire. You just need the ‘From Currency Code’ and ‘To Currency Code’. In the example below, I will be converting the current currency price to base currency price. You can do the vice-versa as well.

The currency convert function has the following parameters:-
currencyConvert($amount, $from, $to=null)

Changing price from any one currency to another

You can manually change any one currency price to another. Suppose, I have a price in USD and I want to change it to NPR. Then, I will write the following code:-

Hope this helps. Thanks.

Magento

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • Pingback: Tweets that mention Magento: Convert Price from Current Currency to Base Currency and vice-versa | Mukesh Chapagain's Blog -- Topsy.com()

  • Santanu Chowdhury

    Your blog posts are extremely valuable for small store owners like us who run in magento. They are crisp, clear and works almost all the time!! Thanks for these great posts. I have particular need to use this conversion code to convert from base currency (INR) to USD so that paypal can accpet. My question is – where I can plug this code in paypal module so that the value passed during checkout is converted to USD before it hits paypal site. Many thanks in advance.

  • Pingback: Magento – Currency Converter in multi-site multi-currency website « Krishna Sunuwar()

  • Dennis

    This one works well, other sites explaned it bad.

  • Shruti 1109

    Please Explain where to place this code. I’ll be highly thankful to you ..

  • rahul

    My question is – where I can plug this code in paypal module so that the
    value passed during checkout is converted to USD before it hits paypal
    site. Many thanks in advance.

  • sunil

    PayPal not working with base currency Rupees in magneto. tell me any solution /payment gateway that work with both ruppes and dollar.

  • P0ZiTR0N

    Thanks. You saved some of my hours

  • vishwa

    Hello Thanks for your nice tutorial

    I have tried the following codes

    $from = ‘USD’;
    $to = ‘NPR’;
    $price = 10;
    $newPrice = Mage::helper(‘directory’)->currencyConvert($price, $from, $to);
    I got the following errors Please help me to change currency one to another
    Fatal error: Call to a member function getCode() on a non-object in
    /public_html/app/code/core/Mage/Directory/Model/Currency.php
    on line 194

  • Amit Kumar

    I have the same problem. I changed the currency based on user group in core/model/store.php. Its showing currency converting fine in cart and product area. But when do the payment, It sent the amount in base currency. Any help please, how to set the currency in payment getway in magento .

  • Great it really helps me out. Thanks man.