Skip to content
Docs
Get RestroPress

Filter

rpress_currency_decimal_count

Updated
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#

ParameterTypeDescription
$decimalsintNumber of decimals for the currency.
$currencystringCurrency 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), in rpress_currency_decimal_filter()

See also#

Was this page helpful?