Skip to content
Docs
Get RestroPress

Filter

rpress_currency_display_decimals

Updated
On this page

Filters the number of decimal places used to display currency values.

Runs in rpress_get_currency_display_decimals after the decimals are cast to an absolute integer and set to 0 when the currency value type is round. It is called from rpress_format_amount.

Parameters#

ParameterTypeDescription
$decimalsintNumber of display decimals.

Return value#

int. The number of display decimals.

Example#

function my_currency_display_decimals( $decimals ) {
	return 'JPY' === rpress_get_currency() ? 0 : $decimals;
}
add_filter( 'rpress_currency_display_decimals', 'my_currency_display_decimals', 10, 1 );

Source#

Applied in:

  • includes/formatting.php (line 94), in rpress_get_currency_display_decimals()

See also#

Was this page helpful?