Skip to content
Docs
Get RestroPress

Filter

rpress_price_range

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

ParameterTypeDescription
$rangestringHTML for the price range.
$fooditem_idintID of the menu item.
$lowfloat|stringLowest price after tax adjustment, unformatted.
$highfloat|stringHighest 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), in rpress_price_range()

See also#

Was this page helpful?