AgentWP

  • Tutorials
  • Themes
  • Plugins
  • Services
  • Contact

Show New Indian Currency Rupee Symbol Correctly in WooCommerce Plugin

Recently a new symbol was introduced for the Indian currency Rupee. WooCommerce already supports this symbol, but it shows as a box most of the times. This is because of lack of support for this new symbol in browsers as it was introduced only recently. One way to fix this issue is to replace the Rupee symbol with Rupee abbreviation, that is, Rs.

To do this, first open functions.php file of your theme, and add this code in it,

add_filter( 'woocommerce_currencies', 'agentwp_add_indian_currency' );
add_filter( 'woocommerce_currency_symbol', 'agentwp_add_indian_currency_symbol' );

function agentwp_add_indian_currency( $currencies ) {
    $currencies['INR'] = 'INR';
    return $currencies;
}

function agentwp_add_indian_currency_symbol( $symbol ) {
    $currency = get_option( 'woocommerce_currency' );
    switch( $currency ) {
        case 'INR': $symbol = 'Rs.'; break;
    }
    return $symbol;
}

Now go to WooCommerce Settings page and you will see that the Indian currency symbol shows the Rupee abbreviation instead.

woocommerce indian currency rupee

Save the WooCommerce settings once and the front-end will show the Rupee abbreviation Rs. instead of the Rupee symbol.

Get useful WordPress related tricks, tips, tutorials and reviews delivered straight to your inbox.

StudioPress - Premium Wordpress Themes
ElegantThemes - Premium Wordpress Themes

Copyright © 2021 · AGENTWP · All Rights Reserved

Copyright © 2021 · awp on Genesis Framework · WordPress · Log in