English (United Kingdom)
Knowledge Base  >  Vik Restaurants  >  Hooks  >  Purchase  >  Restaurant  >  Before Redirect

do_action_ref_array( 'vikrestaurants_redirect_reservation', string &$url, int $resId )

Fires before redirecting the user to the summary landing page of a restaurant reservation.


Description

Trigger hook to manipulate the redirect URL after completing the table booking process (restaurant reservation).

This is the last triggered hook during the booking process. It is possible to use it for any kind of procedures that need to be applied after registering the reservation, such as to send custom notifications.


Parameters

&$url

(string)  The URL to reach after completing the booking process.

$resId

(int)  The ID of the newly saved reservation.


Example

/**
 * Trigger event to manipulate the redirect URL after completing
 * the table booking process (restaurant reservation).
 *
 * @param  string  &$url   The redirect URL (plain).
 * @param  int     $resId  The reservation id.
 */
add_action('vikrestaurants_redirect_reservation', function(&$url, $resId)
{
    // access the reservation details, if needed
    $reservation = VREOrderFactory::getReservation($resId);

    // it is possible to overwrite the landing page after booking a table
    $url = 'index.php';
}, 10, 2);

Changelog

Version Description
1.3 Introduced.
Last Update: 2023-12-27
Helpful?
This site uses cookies. By continuing to browse you accept their use. Further information