How to Add Custom Currency to WooCommerce

add currency to woocommerce

If you are looking for the best way to add currency to WooCommerce this quick tutorial will guide you and help you add custom currency to your WooCommerce store.

WooCommerce has a filter that allows you to extend the currency options that are available in your store.

Using a simple code snippet added to your child theme’s functions.php file or via a plugin you can add currency to WooCommerce.

It is important to remember that you should not add this custom code directly to the WooCommerce parent theme’s functions.php file since this will be overwritten when an update is done.

Add Currency to WooCommerce

You can add currency to WooCommerce as well as add a currency symbol to  WooCommerce using the code snippets below :

/**
* Custom currency and the currency symbol
*/
add_filter( 'woocommerce_currencies', 'njengah_add_my_currency' );

function njengah_add_my_currency( $currencies ) {

$currencies['ABC'] = __( 'Currency name', 'woocommerce' );
return $currencies;

}

add_filter('woocommerce_currency_symbol', 'njengah_add_my_currency_symbol', 10, 2);

function njengah_add_my_currency_symbol( $currency_symbol, $currency ) {

switch( $currency ) {
case 'ABC': $currency_symbol = '$'; break;
}
return $currency_symbol;

}

You should place the code at the end of your child theme functions.php file and ensure that there are no errors.

You should also replace the current name and the symbol in the code to reflect the custom currency that you want to add to WooCommerce.

Conclusion

In this post, we have looked at how you can use a code snippet to add currency to WooCommerce and also a custom currency symbol.

You should be careful when adding this code snippet to your theme to avoid breaking your site. It helps to begin by backing up your site so that you can restore it if something goes wrong.

Similar Articles

  1. WooCommerce Redirect After Logout [Ultimate Guide]