WordPress at Your Fingertips

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

String. Currency code




#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

Code of get_woocommerce_currency() WC 5.5.2

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

From category: WooCommerce

No comments
    Log In