Drupal-commerce

Setting up a Currency Converter in a Drupal Store

by Dan

Since eCommerce is growing rapidly in all over the world and because there are thousands of countries and hundreds of currencies, it is essential to have a powerful tool for currency conversion at your drupal shop. Definitely, there are different options for currency conversion that meet various conversion requirements. Particularly, in this article we are going to address two solutions for converting currency:

  1. Currency conversion in Drupal Commerce core
  2. Currency converter module

You might like to read : Learn Drupal – Best Drupal Online Resources for Beginners and Developers

Currency Conversion In Drupal Commerce Core

Although Currency Conversion in Drupal Commerce Core is a very limited use-case, it is paramount to familiarize yourself with the pricing rules that every prime ecommerce shop is going to apply. In the next example, we aim to convert all of the products prices to Euros. For example, Product PRO_01 is listed as $32 US dollars in the database, but it will be listed at the end of our example as 7,60 Euros.

Enable Multiple Currencies

1. Navigate to Store Configuration–> Currency Settings

Enable Multiple Currencies 1

Hint: you cannot convert to any currency unless you have enabled it in your currency settings.

2. Once you are on the Currency setting screen, start enabling the currencies you are targeting and do not forget to set the default currency.

Enable Multiple Currencies 2

 

3. Say, you have a product called PRO_01, go to the associated screen of that product to set the currency. You will see various currency options according to the currency you have enabled in the previous step.

Hint: with enabling multiple currencies, you can easily set different currency for each product.

Enable Multiple Currencies 3

In case you prefer using the conversion rate as a constant variable, then simply use Price rules for converting from one currency to another. For instance, if you want to calculate the conversion based on a static conversion rate from dollar to Euro, say 1$=0.76 Euros. Then it is better to use Drupal ecoomerce core price rules.

Go to the Products dashboard and there you can see every product and its corresponding price in the currency you have set in the previous steps. Now, we need to build a rule for the currency conversion.

Product Pricing Rules

Enable Multiple Currencies 4

4. Navigate to Administration–> Store –> “Configuration” –> Product Pricing Rules.

Product Pricing Rule 1

5. Click on “Add a pricing rule” in the product pricing rules page

Product Pricing Rule 2

6. Give your rule a suitable name, and then press “Add Condition.”

7. Now you should be at the  “Add a new Condition” page, and you are about choosing a data comparison

Product Pricing Rule 3

8. Using the object navigator Select “commerce-line-item:commerce-unit-price:currency-code”Product Pricing Rule 49. Press continue

10. In the DATA VALUE section, choose the currency you want to convert, in our example, we aim to convert the US dollar to something else (Euro), so select USD.

Product Pricing Rule 511. In Administration–> Store –> “Configuration” –> Product Pricing Rules, click “Add Action” and select “Multiply the unit price by some amount”; it is 0.76 for US $ to Euro for our example.

Product Pricing Rule 6

Product Pricing Rule 7

Hint: Of course the conversion rate is changeable overtime, but in our example we assume that you need simple conversion using static conversion rate. But for dynamic currency conversion, it is recommended to use “Commerce Multicurrency” or any other reliable tool.

12. In Administration–> Store –> “Configuration” –> Product Pricing Rules, click “Add Action” and select “Convert the unit price to a different currency” so that we can actually convert the currency from US dollars to a new currency.

Product Pricing Rule 8

Hint: this exchange is only going to change the currency symbol; it will not actually tweak the numbers

13. In Administration–> Store –> “Configuration” –> Product Pricing Rules, click “Add Action” –> and at CUREENCY section select the currency symbol to be the final currency symbol. In our example, it is Euro.

Product Pricing Rule 9

Currency Converter Module

For quick currency conversion for 10 currencies, Currency Converter Module is a great tool. You can freely choose from several banks for currency undertakes. Maslouski Yauheni has developed this powerful currency converter module to permit every seller enjoying multicurrency shop.

You might like to read : Learn Drupal – Best Drupal Online Resources for Beginners and Developers

This module is flexible and enjoys numerous features, let`s list them.

  • It is a great tool for performing currency conversion according to the latest exchange rates from banks.
  • You can update the module regularly to apply the most recent conversion rates.
  • Just flush caches and run cron after the update
  • You can disable/enable any currency at any time
  • The position of currencies s interchangeable in the block
  • You can identify any currency as the prime one
  • To get the exchange rate you have the option to choose the bank you most trust
  • You can easily enable/disable the built in css

In a Few words

Ecommerce is the trend today and no one can ignore the importance of having a shop that supports various currency conversions. Above, we have mentioned two methods for converting currency at Drupal. Enjoy!

Related Posts