Filter
rpress_get_fooditem_price
On this page
Filters the base price of a menu item.
Runs at the end of RPRESS_Fooditem::get_price(). The price comes from the rpress_price post meta, sanitised, or 0 when empty. It does not apply to variable prices; use rpress_get_variable_prices for those.
Available since RestroPress 1.0.0.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$price | string|float | The menu item price. |
$ID | int | Menu item ID. |
Return value#
string|float. The price to use.
Example#
function my_fooditem_price( $price, $fooditem_id ) {
// Apply a 10 percent surcharge to every menu item.
return (float) $price * 1.10;
}
add_filter( 'rpress_get_fooditem_price', 'my_fooditem_price', 10, 2 );
Notes#
Changes the price as read through the object only; the stored meta is untouched.
Source#
Applied in:
includes/class-rpress-fooditem.php(line 249), inRPRESS_Fooditem::get_price()
See also#
Was this page helpful?
