WooCommerceWordPress

How to add custom currency symbol in WooCommerce

0
510
2019 / 08 / 29

Sometime you need your own currency symbol in your store. For example, if your currency is Singapore Dollar, the WooCommerce shows it as “$”. Your site visitors will be confused whether it is US Dollar or what.

To make your currency symbol precise and more informative you can introduce your own symbol which helps users to understand your currency.

You need to add following snippet in functions.php of your child theme:

add_filter( 'woocommerce_currencies', 'add_c_currency' );
function add_c_currency( $c_currency ) {
     $c_currency['SING_DOLLAR'] = __( 'Singaporian Dollar ', 'woocommerce' );
     return $c_currency;
}
add_filter('woocommerce_currency_symbol', 'add_c_currency_symbol', 10, 2);
function add_c_currency_symbol( $custom_currency_symbol, $custom_currency ) {
     switch( $custom_currency ) {
         case 'SING_DOLLAR': $custom_currency_symbol = 'SG

 

Please note that you can add your own currency symbol here. I have added a new currency with name "Singaporian Dollar" and the symbol I like is "SG$".

The "SG" is a country code of Singapore so instead of showing "$" it is more informative to show "SG$".

 

How to select currency in WooCommerce

Navigate to WooCommerce > Settings > General and scroll down till "Currency Options". Under currency you will see your currency name (Singaporian Dollar in my case) Click "Save Changes" and open products page of your store and your new currency symbol will be reflected.  

Examples

Product   Cart Table   ; break; } return $custom_currency_symbol; }

 

Please note that you can add your own currency symbol here. I have added a new currency with name “Singaporian Dollar” and the symbol I like is “SG$”.

The “SG” is a country code of Singapore so instead of showing “$” it is more informative to show “SG$”.

 

How to select currency in WooCommerce

Navigate to WooCommerce > Settings > General and scroll down till “Currency Options”.

Under currency you will see your currency name (Singaporian Dollar in my case)

Click “Save Changes” and open products page of your store and your new currency symbol will be reflected.

 

Examples

Product

 

Cart Table

 

Hi, I am a full-stack web developer with 5+ years of experience in working with different web technologies. Do you want to ask something? just send me a message through the contact form. Please visit my portfolio at hamzamehmood.com. Thanks