Skip to content
Docs
Get RestroPress

Filter

rpress_fooditem_redirect_to_checkout

Updated
On this page

Filters whether adding the item redirects to checkout.

Runs in the purchase form. The default is the result of rpress_straight_to_checkout(). When true, a hidden rpress_redirect_to_checkout input is added to the form.

Parameters#

ParameterTypeDescription
$redirectboolWhether to redirect straight to checkout.
$fooditem_idintMenu item ID.
$argsarrayPurchase link arguments.

Return value#

bool. True to add the redirect-to-checkout input.

Example#

function my_redirect_to_checkout( $redirect, $fooditem_id, $args ) {
	return ! empty( $args['direct'] ) ? true : $redirect;
}
add_filter( 'rpress_fooditem_redirect_to_checkout', 'my_redirect_to_checkout', 10, 3 );

Notes#

Fires from both the list and grid purchase link builders.

Source#

Applied in:

  • includes/template-functions.php (line 220), in rpress_get_purchase_link()
  • includes/template-functions.php (line 363), in rpress_get_purchase_link_grid()

See also#

Was this page helpful?