Filter
rpress_is_orderable
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#
| Parameter | Type | Description |
|---|---|---|
$orderable | bool | Default true. |
$fooditem_id | int | Menu 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), inrpress_fooditem_available()
See also#
Was this page helpful?
