Skip to content

Instantly share code, notes, and snippets.

@wbcomdev
Last active May 14, 2021 05:56
Show Gist options
  • Select an option

  • Save wbcomdev/c47ee488496bd48ed0a07e1f3b097a69 to your computer and use it in GitHub Desktop.

Select an option

Save wbcomdev/c47ee488496bd48ed0a07e1f3b097a69 to your computer and use it in GitHub Desktop.
/**
* Add Custom currency name and currency symbol.
*/
function wb_add_my_currency( $currencies ) {
$currencies['ABC'] = __( 'Currency name', 'woocommerce' );
return $currencies;
}
add_filter( 'woocommerce_currencies', 'wb_add_my_currency' );
/**
* Add Custom currency symbol.
*/
function wb_add_my_currency_symbol( $currency_symbol, $currency ) {
switch ( $currency ) {
case 'ABC':
$currency_symbol = '$';
break;
}
return $currency_symbol;
}
add_filter( 'woocommerce_currency_symbol', 'wb_add_my_currency_symbol', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment