Last active
July 7, 2024 14:50
-
-
Save woogists/72947b71e48a62f15f5548283d4ed00f to your computer and use it in GitHub Desktop.
Add a custom currency / symbol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Custom currency and currency symbol | |
*/ | |
add_filter( 'woocommerce_currencies', 'add_my_currency' ); | |
function add_my_currency( $currencies ) { | |
$currencies['ABC'] = __( 'Currency name', '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 'ABC': $currency_symbol = '$'; break; | |
} | |
return $currency_symbol; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey guys, does anyone have a solution for "Unsupported Currency" in woocommerce?!
I mean, it can't be there is no solution for it, can it?