get_woocommerce_currency()WC 1.0

Gets site currency code. For example: RUB.

This code (option) is stored in the WP woocommerce_currency 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

0

#1 Get the currency code of the website

echo get_woocommerce_currency(); //> RUB
0

#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() code WC 8.7.0

function get_woocommerce_currency() {
	return apply_filters( 'woocommerce_currency', get_option( 'woocommerce_currency' ) );
}