Skip to content
Docs
Get RestroPress

Filter

rpress_fooditem_increase_earnings_amount

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

ParameterTypeDescription
$new_amountfloatProposed new earnings total (current earnings plus the amount).
$current_earningsfloatCurrent stored earnings.
$amountint|floatAmount being added.
$fooditemRPRESS_FooditemThe 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), in RPRESS_Fooditem::increase_earnings()

See also#

Was this page helpful?