-
-
Save bobwol/dbe596e5a1e4881ddce0d5194f4bfa62 to your computer and use it in GitHub Desktop.
Add a custom currency / symbol
This file contains hidden or 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