Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Change a currency symbol
/**
* Change a currency symbol
*/
add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2);
function change_existing_currency_symbol( $currency_symbol, $currency ) {
switch( $currency ) {
case 'AUD': $currency_symbol = 'AUD$'; break;
}
return $currency_symbol;
}
@imranh654

This comment has been minimized.

Copy link

@imranh654 imranh654 commented Mar 15, 2020

this does not work for me can anyone please check?

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

function change_existing_currency_symbol( $currency_symbol, $currency ) {
switch( $currency ) {
case 'د.ك': $currency_symbol = 'KD'; break;
}
return $currency_symbol;
}

@inside83

This comment has been minimized.

Copy link

@inside83 inside83 commented Mar 22, 2020

It totally works, just used it.
Maybe try switching because I doubt this 'د.ك' is an international currency symbol.

@ineedspd

This comment has been minimized.

Copy link

@ineedspd ineedspd commented Apr 24, 2020

Hi imran

This will work
/**

  • Change a currency symbol
    */
    add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2);

function change_existing_currency_symbol( $currency_symbol, $currency ) {
switch( $currency ) {
case 'KWD': $currency_symbol = 'KD'; break;
}
return $currency_symbol;
}

@imranh654

This comment has been minimized.

Copy link

@imranh654 imranh654 commented Apr 24, 2020

hi,
thank you for your comments i solved the problem using: Custom Currency Symbol for WooCommerce Plugin

@Arsl143

This comment has been minimized.

Copy link

@Arsl143 Arsl143 commented Jul 4, 2020

/**

  • Custom currency and currency symbol
    */
    add_filter( 'woocommerce_currencies', 'add_my_currency' );

function add_my_currency( $currencies ) {
$currencies['BHD'] = __( 'Bahraini dinar', '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 'BHD': $currency_symbol = 'BD'; break;
}
return $currency_symbol;
}

not working on react-native app

@Raselnila

This comment has been minimized.

Copy link

@Raselnila Raselnila commented Aug 29, 2020

thanks, Sir Your Code working is fine
ineedspd commented on Apr 24

Hi imran

This will work
/**

Change a currency symbol
*/
add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2);
function change_existing_currency_symbol( $currency_symbol, $currency ) {
switch( $currency ) {
case 'KWD': $currency_symbol = 'KD'; break;
}
return $currency_symbol;
}

@Raselnila

This comment has been minimized.

Copy link

@Raselnila Raselnila commented Aug 29, 2020

Hi imran

This will work
/**

  • Change a currency symbol
    */
    add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2);

function change_existing_currency_symbol( $currency_symbol, $currency ) {
switch( $currency ) {
case 'KWD': $currency_symbol = 'KD'; break;
}
return $currency_symbol;
}

well working thanks a lot

@Asanka8888

This comment has been minimized.

Copy link

@Asanka8888 Asanka8888 commented Jan 19, 2021

Dears,

Please can you help. Below is not changing currency symbol in currency options in Woocommerce.

/**

  • Change a currency symbol
    */
    add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2);

function change_existing_currency_symbol( $currency_symbol, $currency ) {
switch( $currency ) {
case 'රු': $currency_symbol = 'Rs.'; break;
}
return $currency_symbol;
}

@nyf-official

This comment has been minimized.

Copy link

@nyf-official nyf-official commented Apr 7, 2021

/**

  • Change a QAR currency symbol
    */
    add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2);

function change_existing_currency_symbol( $currency_symbol, $currency ) {
switch( $currency ) {
case 'QAR': $currency_symbol = 'QAR'; break;
}
return $currency_symbol;
}

@virajadhihetty

This comment has been minimized.

Copy link

@virajadhihetty virajadhihetty commented Jun 8, 2021

රු


Try this:

/**

  • Change a currency symbol
    */
    add_filter('woocommerce_currency_symbol', 'change_existing_currency_symbol', 10, 2);

function change_existing_currency_symbol( $currency_symbol, $currency ) {
switch( $currency ) {
case 'LKR': $currency_symbol = 'Rs'; break;
}
return $currency_symbol;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment