Skip to content
Docs
Get RestroPress

Filter

rpress_is_orderable

Updated
On this page

Filters whether a menu item can currently be ordered.

The default is true. Core attaches an availability check to this filter at priority 5, which makes items unavailable outside their availability schedule. Return false to block ordering of a menu item.

Parameters#

ParameterTypeDescription
$orderableboolDefault true.
$fooditem_idintMenu item ID.

Return value#

bool. Whether the menu item can be ordered.

Example#

function my_is_orderable( $orderable, $fooditem_id ) {
	if ( 'yes' === get_post_meta( $fooditem_id, 'my_sold_out', true ) ) {
		return false;
	}
	return $orderable;
}
add_filter( 'rpress_is_orderable', 'my_is_orderable', 10, 2 );

Source#

Applied in:

  • includes/rp-core-functions.php (line 2757), in rpress_fooditem_available()

See also#

Was this page helpful?