WordPress at a glance

get_woocommerce_currency() WC 1.0

Gets site currency code. For example: RUB.

This code (option) is stored in the WP woocommerce_currency option.

Works based on: get_option()
✈ 1 time = 0.001569s = very slow | 50000 times = 1.66s = fast | PHP 7.1.5, WP 4.9.1
Hooks in 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

Code of get woocommerce currency: woocommerce/includes/wc-core-functions.php WC 3.6.4

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

Related Functions

From category: WooCommerce

No comments
    Hello, !     Log In . Register