Currency::get_currency_symbol_position( $code )
Get and allow filtering of the currency symbol position.
Contents
Parameters
- $post_id
-
(int|null) (Required)
Return
(string)
Source
File: src/Tickets/Commerce/Utils/Currency.php
public static function get_currency_symbol_position( $code ) {
$map = static::get_default_currency_map();
if ( ! isset( $map[ $code ]['position'] ) ) {
$currency_position = 'prefix';
} else {
$currency_position = $map[ $code ]['position'];
}
if (
'prefix' === $currency_position
&& 'EUR' === $code
&& 0 !== strpos( get_locale(), 'en_' ) // site language does not start with 'en_'
) {
$currency_position = 'postfix';
}
/**
* Whether the currency position should be 'prefix' or 'postfix' (i.e. suffix).
*
* @since 5.2.3
*
* @param string $currency_position The currency position string.
*
* @return string
*/
$currency_position = apply_filters( 'tec_tickets_commerce_currency_symbol_position', $currency_position );
// Plugin's other code only accounts for one of these two values.
if ( ! in_array( $currency_position, [ 'prefix', 'postfix' ], true ) ) {
$currency_position = 'prefix';
}
return $currency_position;
}
Changelog
| Version | Description |
|---|---|
| 4.7 | |
| 4.10.8 | Introduced. |