Filter
rpress_final_price
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#
| Parameter | Type | Description |
|---|---|---|
$price | string|float | Price after any percentage discount. |
$fooditem_id | int | ID of the menu item. |
$user_purchase_info | array|null | Purchase 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), inrpress_get_fooditem_final_price()
See also#
Was this page helpful?
