Skip to content
Docs
Get RestroPress

Filter

rpress_final_price

Updated
On this page

Filters the final price of a menu item after a percentage discount is applied.

Runs at the end of rpress_get_fooditem_final_price. The price starts from the rpress_price meta (or an override amount) and is reduced when the purchase info contains a percentage discount code. Flat-rate discounts are ignored by this calculation.

Parameters#

ParameterTypeDescription
$pricestring|floatPrice after any percentage discount.
$fooditem_idintID of the menu item.
$user_purchase_infoarray|nullPurchase information that may contain a 'discount' code, or null.

Return value#

string|float. The final price.

Example#

function my_final_price( $price, $fooditem_id, $user_purchase_info ) {
	return max( 0, (float) $price );
}
add_filter( 'rpress_final_price', 'my_final_price', 10, 3 );

Source#

Applied in:

  • includes/fooditem-functions.php (line 202), in rpress_get_fooditem_final_price()

See also#

Was this page helpful?