get_woocommerce_currency()
Gets site currency code. For example: RUB.
This code (option) is stored in the WP woocommerce_currency
option.
Uses: get_option()
1 time — 0.001569 sec (very slow) | 50000 times — 1.66 sec (fast) | PHP 7.1.5, WP 4.9.1
Hooks from the function
Return
String
. Currency code
Usage
get_woocommerce_currency();
Examples
#1 Get the currency code of the website
echo get_woocommerce_currency(); //> RUB
#2 Get the name of the current currency
To it we use the get_woocommerce_currencies() function.
$currencies = get_woocommerce_currencies(); $currency_code = get_woocommerce_currency(); echo $currencies[ $currency_code ]; //> Russian rouble
get_woocommerce_currency() get woocommerce currency code WC 9.6.1
function get_woocommerce_currency() { return apply_filters( 'woocommerce_currency', get_option( 'woocommerce_currency' ) ); }