Currency::get_currency_precision( string $code )
Return the currency precision to use as the number of decimals allowed.
Contents
Parameters
- $code
-
(string) (Required) The currency 3-letter code.
Return
(string)
Source
File: src/Tickets/Commerce/Utils/Currency.php
public static function get_currency_precision( $code ) {
$map = static::get_default_currency_map();
$precision = 2;
if ( isset( $map[ $code ] ) ) {
$precision = $map[ $code ]['decimal_precision'];
}
/**
* Filter the specific currency precision before returning. $code is the 3-letter currency code.
*
* @since 5.3.0
*
* @param int $precision The currency precision.
*
* @return int
*/
$precision = apply_filters( "tec_tickets_commerce_currency_{$code}_precision", $precision );
/**
* Filter all currency symbols before returning.
*
* @since 5.3.0
*
* @param int $precision The currency precision.
*
* @return int
*/
return apply_filters( 'tec_tickets_commerce_currency_precision', $precision );
}
Changelog
| Version | Description |
|---|---|
| 5.3.0 | Introduced. |