English (United Kingdom)
Knowledge Base  >  Vik Appointments  >  Hooks  >  Purchase  >  Packages  >  Before Redirect

apply_filters_ref_array( 'vikappointments_redirect_packages_order', bool $status, string &$url, int $order )

Fires before redirecting the user to the summary landing page.


Description

Trigger hook to manipulate the redirect URL after completing the ordering process of the packages.

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


Parameters

$status

(bool)  True on success, false otherwise.

&$url

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

$order

(int)  The ID of the newly saved order.


Example

/**
 * Trigger hook to manipulate the redirect URL after completing
 * the packages purchase process.
 *
 * @param  boolean  $status  True on success, false otherwise.
 * @param  string   &$url    The redirect URL (plain).
 * @param  integer  $order   The order id.
 */
add_filter('vikappointments_redirect_packages_order', function($status, &$url, $order)
{
    // access the order details, if needed
    $order = VAPOrderFactory::getPackages($order);

    // it is possible to overwrite the landing page after ordering a package
    $url = 'index.php';

    return $status;
}, 10, 3);

Changelog

Version Description
1.2 Introduced.
Last Update: 2021-08-05
Helpful?
See Also: