Skip to content
Docs
Get RestroPress

Filter

rpress_checkout_upsell_needs_popup

Updated
On this page

Filters whether adding an upsell item needs the item popup.

True when the item has variable prices, a required add-on group or add-on minimum, or pre-selected default add-ons, because a direct add would skip those choices. Return true to always open the popup for an item, or false to add directly.

Parameters#

ParameterTypeDescription
$needsboolWhether the popup is needed.
$fooditem_idintMenu item (fooditem) ID.

Return value#

bool. Whether the popup is needed.

Example#

add_filter( 'rpress_checkout_upsell_needs_popup', 'my_upsell_needs_popup', 10, 2 );
function my_upsell_needs_popup( $needs, $fooditem_id ) {
	return $needs || (bool) get_post_meta( $fooditem_id, '_my_needs_choice', true );
}

Source#

Applied in:

  • includes/features/checkout-upsell/loader.php (line 257), in rpress_checkout_upsell_needs_popup()
Was this page helpful?