Filter
rpress_fooditem_increase_earnings_amount
On this page
Filters the new earnings total before a menu item's earnings are increased.
Runs in RPRESS_Fooditem::increase_earnings() before the _rpress_fooditem_earnings meta is written. The first value is the current earnings plus the amount. Changing it changes what is stored.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$new_amount | float | Proposed new earnings total (current earnings plus the amount). |
$current_earnings | float | Current stored earnings. |
$amount | int|float | Amount being added. |
$fooditem | RPRESS_Fooditem | The menu item object. |
Return value#
float. The earnings total to store.
Example#
function my_increase_earnings_amount( $new_amount, $current_earnings, $amount, $fooditem ) {
// Round the stored total to two decimals.
return round( (float) $new_amount, 2 );
}
add_filter( 'rpress_fooditem_increase_earnings_amount', 'my_increase_earnings_amount', 10, 4 );
Source#
Applied in:
includes/class-rpress-fooditem.php(line 511), inRPRESS_Fooditem::increase_earnings()
See also#
Was this page helpful?
