Italian (Italy)
Knowledge Base  >  Vik Restaurants  >  Hooks  >  Purchase  >  Take-Away  >  Before Redirect

do_action_ref_array( 'vikrestaurants_redirect_order', string &$url, int $ordId )

Fires before redirecting the user to the summary landing page of a take-away order.


Description

Trigger hook to manipulate the redirect URL after completing the food ordering process (take-away order).

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 order, such as to send custom notifications.


Parameters

&$url

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

$ordId

(int)  The ID of the newly saved order.


Example

/**
 * Trigger event to manipulate the redirect URL after completing
 * the food ordering process (take-away order).
 *
 * @param  string  &$url   The redirect URL (plain).
 * @param  int     $ordId  The order id.
 */
add_action('vikrestaurants_redirect_order', function(&$url, $ordId)
{
    // access the order details, if needed
    $order = VREOrderFactory::getOrder($ordId);

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

Changelog

Version Description
1.3 Introduced.
Ultimo aggiornamento: 2023-12-27
Utile?
Potrebbe interessarti: