Filter
rpress_format_amount_decimals
On this page
Filters the number of decimals used when formatting an amount.
Runs in rpress_format_amount when decimals are enabled, with a default of 2. RestroPress hooks rpress_currency_decimal_filter at priority 10. The result is then passed through rpress_get_currency_display_decimals before number_format is called.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$decimals | int | Number of decimals. Defaults to 2. |
$amount | string | The sanitized amount being formatted. |
Return value#
int. The number of decimals.
Example#
function my_format_amount_decimals( $decimals, $amount ) {
return $decimals;
}
add_filter( 'rpress_format_amount_decimals', 'my_format_amount_decimals', 20, 2 );
Source#
Applied in:
includes/formatting.php(line 131), inrpress_format_amount()
See also#
Was this page helpful?
