Adding a new currency to WooCommerce

Seemed to me that adding a new currency to WooCommerce would be extremely easy and wide spread which turns out is not the case. I couldn’t find any filter in the filter list with the hooks and filters list.

Anyway I managed to find out that there are two filters for this: ‘woocommerce_currencies’  and ‘woocommerce_currency_symbol’. Adding the bulgarian currency for instance is as easy as:

add_filter( 'woocommerce_currencies', 'add_bgn_currency' );
function add_bgn_currency( $currencies ) {
 $currencies['BGN'] = __( 'Bulgarian lev', 'woocommerce' );
 return $currencies;
}
add_filter('woocommerce_currency_symbol', 'add_bgn_currency_symbol', 10, 2);
function add_bgn_currency_symbol( $currency_symbol, $currency ) {
 switch( $currency ) {
 case 'BGN': $currency_symbol = 'лв.'; break;
 }
 return $currency_symbol;
}

Note: All this code can be placed somewhere in your theme’s functions.php

The result is that now the currency is shown in the Currency list:

WooCommerce Currency Settings
WooCommerce Currency Settings

Anyway one problem still persists – the currency symbol position is totally unmanagable from a hook. It can be only set site-wide through the settings section of WooCommerce. It is also placed in a not-so-intuitive place:

WooCommerce Pricing Position
WooCommerce Pricing Position

This is how far I’ve got with the multilingual shop with WPML and WooCommerce. Still wondering how to make the symbol position to be currency-specific (and not be afraid to update the plugin afterwards). Maybe I’ll have to make it in JS in the end.

I’ll keep you posted! And follow this guy:


//

10 Replies to “Adding a new currency to WooCommerce”

    1. Did you checked at the bottom of the Currency list? You should set it from there before the new currency is displayed in th WooCommerce admin panel.
      Check the newly added screenshot.

      1. Hi

        You showed good screen shot of the completed job but you never should the screen shot of the exact file you placed the code. (Step 1 to the last Step)

        Please do that.

        1. Thanks for the remark. The code should be added to the functions.php of your theme. (I’ve added it also in the post).

          Good luck!

    1. If you paste the code at the end of functions.php of your current theme is anything changed?

      And which version of WooCommerce are you using?

  1. Най накрая да намеря как става това чудо:) От колко време търся да сложа .лв:)

    Мн. благодаря за информацията!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.