Filter
rpress_price_range
On this page
Filters the HTML for the price range of a menu item with variable prices.
Runs at the end of rpress_price_range after the lowest and highest prices are adjusted for tax settings and formatted. The range is one span for the low price, followed by a separator and a second span for the high price when the prices differ.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$range | string | HTML for the price range. |
$fooditem_id | int | ID of the menu item. |
$low | float|string | Lowest price after tax adjustment, unformatted. |
$high | float|string | Highest price after tax adjustment, unformatted. |
Return value#
string. The HTML for the price range.
Example#
function my_price_range( $range, $fooditem_id, $low, $high ) {
if ( $low < $high ) {
return esc_html__( 'From', 'my-plugin' ) . ' ' . rpress_currency_filter( rpress_format_amount( $low ) );
}
return $range;
}
add_filter( 'rpress_price_range', 'my_price_range', 10, 4 );
Source#
Applied in:
includes/fooditem-functions.php(line 436), inrpress_price_range()
See also#
Was this page helpful?
