Filter
rpress_currency_decimal_count
On this page
Filters the number of decimal places for the store currency.
Runs in rpress_currency_decimal_filter after the default of 2 has been replaced with 0 for currencies RIAL, JPY, TWD and HUF. RestroPress hooks this function onto rpress_sanitize_amount_decimals and rpress_format_amount_decimals.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$decimals | int | Number of decimals for the currency. |
$currency | string | Currency code of the store. |
Return value#
int. The number of decimals.
Example#
function my_currency_decimal_count( $decimals, $currency ) {
return 'KWD' === $currency ? 3 : $decimals;
}
add_filter( 'rpress_currency_decimal_count', 'my_currency_decimal_count', 10, 2 );
Source#
Applied in:
includes/formatting.php(line 277), inrpress_currency_decimal_filter()
See also#
Was this page helpful?
