Woocommerce - change currency sign to letter

How to change the currency sign to letters in Woocommerce

0 Shares
0
0
0

Many users ask how to replace the currency symbol in Woocommerce with letters or vice versa.

There are several ways to replace the currency symbol in WordPress Woocommerce, but one simple and working way is to run functions.php.

Open the functions.php file of your current theme and add a filter for woocommerce. It’s worth noting here that the filter should be added to the end of the file.

The code to replace the currency symbol with letters:

add_filter( 'woocommerce_currencies', 'add_my_currency' );

function add_my_currency( $currencies ) {

     $currencies[USD] = __( 'Dollar USA', 'woocommerce' );
     return $currencies;

}

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

function add_my_currency_symbol( $currency_symbol, $currency ) {

     switch( $currency ) {
         case 'USD': $currency_symbol = 'dollar'; break;
     }

     return $currency_symbol;

}

This way you can replace the currency icon with letters or vice versa.

You can also use existing plugins, but this code is easy to use and I recommend using it.

0 Shares
Leave a Reply

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

You May Also Like