Merge pull request #16680 from atimmer/stories/at/improve-currencies-performance
Cache currencies for performance
This commit is contained in:
commit
2576ba7f8e
|
@ -281,7 +281,10 @@ function get_woocommerce_currency() {
|
|||
* @return array
|
||||
*/
|
||||
function get_woocommerce_currencies() {
|
||||
return array_unique(
|
||||
static $currencies;
|
||||
|
||||
if ( ! isset( $currencies ) ) {
|
||||
$currencies = array_unique(
|
||||
apply_filters( 'woocommerce_currencies',
|
||||
array(
|
||||
'AED' => __( 'United Arab Emirates dirham', 'woocommerce' ),
|
||||
|
@ -450,6 +453,10 @@ function get_woocommerce_currencies() {
|
|||
);
|
||||
}
|
||||
|
||||
return $currencies;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Currency symbol.
|
||||
*
|
||||
|
@ -625,7 +632,6 @@ function get_woocommerce_currency_symbol( $currency = '' ) {
|
|||
'ZAR' => 'R',
|
||||
'ZMW' => 'ZK',
|
||||
) );
|
||||
|
||||
$currency_symbol = isset( $symbols[ $currency ] ) ? $symbols[ $currency ] : '';
|
||||
|
||||
return apply_filters( 'woocommerce_currency_symbol', $currency_symbol, $currency );
|
||||
|
|
Loading…
Reference in New Issue