Skip to content
Docs
Get RestroPress

Filter

rpress_has_variable_prices

Updated
On this page

Filters whether a menu item has variable prices.

Runs in RPRESS_Fooditem::has_variable_prices() with the value of the _variable_pricing meta. The result is cast to bool and is also used by get_prices(), so overriding it changes whether variable prices are loaded.

Available since RestroPress 1.0.

Parameters#

ParameterTypeDescription
$retboolWhether the menu item has variable prices.
$IDintMenu item ID.

Return value#

bool. True if the menu item should be treated as having variable prices.

Example#

function my_has_variable_prices( $ret, $fooditem_id ) {
	return 123 === (int) $fooditem_id ? false : $ret;
}
add_filter( 'rpress_has_variable_prices', 'my_has_variable_prices', 10, 2 );

Source#

Applied in:

  • includes/class-rpress-fooditem.php (line 308), in RPRESS_Fooditem::has_variable_prices()

See also#

Was this page helpful?