get_woocommerce_currencies()
Gets the complete list of WooCommerce currencies. The list is returned as an array: currency code => currency name.
1 time — 0.000377 sec (fast) | 50000 times — 0.90 sec (very fast) | PHP 7.1.5, WP 4.9.1
Hooks from the function
Returns
Array. Where the key will be the currency code, and the value is the translated currency name (in the current locale).
Usage
$currencies = get_woocommerce_currencies();
Examples
#1 Get an array of all Woocommerce currencies.
$currencies = get_woocommerce_currencies(); print_r( $currencies ); /* Array ( [AED] => UAE Dirham [AFN] => Afghan Afghani [ALL] => Albanian lek [AMD] => Armenian Dram. [ANG] => Netherlands Antilles guilder [AOA] => Angolan Quanza [ARS] => Argentine peso [AUD] => Australian dollar [AWG] => Aruban florin [AZN] => Azerbaijani manat [BAM] => Convertible mark of Bosnia and Herzegovina [BBD] => Barbados dollar [BDT] => Bangladeshi Taka [BGN] => Bulgarian lion [BHD] => Bahraini dinar [BIF] => Burundi franc ... ) */
#2 Display the name of a particular currency by its code
$currencies = get_woocommerce_currencies(); echo $currencies ['RUB']; //> Russian ruble
get_woocommerce_currencies() get woocommerce currencies code WC 10.7.0
function get_woocommerce_currencies() {
static $currencies;
if ( ! isset( $currencies ) ) {
$currencies = array_unique(
/**
* Filters the list of available currencies.
*
* @since 2.1.0
* @param array $currencies Array of currency codes and names.
*/
apply_filters( 'woocommerce_currencies', include WC()->plugin_path() . '/i18n/currencies.php' )
);
}
return $currencies;
}