/** * License: Public domain. * * Description: Snippets adding support for the KUDOS and TESTKUDOS currency. * Author Christian Grothoff */ // See also https://gist.github.com/woogists/72947b71e48a62f15f5548283d4ed00f#file-wc-add-currency-symbol-php. add_filter( 'woocommerce_currencies', 'add_my_currency' ); /** * Extend the list of currencies. * * @param array $currencies array with strings with the names of supported currencies. * * @return array with extended list of currencies. */ function add_my_currency( $currencies ) { $currencies['KUDOS'] = __( 'KUDOS', 'woocommerce' ); $currencies['TESTKUDOS'] = __( 'TESTKUDOS', 'woocommerce' ); return $currencies; } add_filter( 'woocommerce_currency_symbol', 'add_my_currency_symbol', 10, 2 ); /** * Lookup a currency symbol by the given currency. * * @param string $currency_symbol Symbol the currency was mapped to so far. * @param string $currency Currency to map. * * @return desired currency symbol, usually the input, except for the two currencies we know. */ function add_my_currency_symbol( $currency_symbol, $currency ) { switch ( $currency ) { case 'KUDOS': $currency_symbol = 'ク'; break; case 'TESTKUDOS': $currency_symbol = 'テ'; break; } return $currency_symbol; }