English (United Kingdom)
Knowledge Base  >  Vik Appointments  >  Hooks  >  Packages  >  Status Change

apply_filters( 'vikappointments_status_change_packageorder', bool $status, object $data )

Fires every time the status of a package order changes.

It is possible to use the following code to access the details of the changed order.

VAPLoader::import('libraries.order.factory');
$order = VAPOrderFactory::getPackages($data->id_order);

Description

Trigger hook to let the plugins be notified every time the status of the order changes.


Parameters

$status

(bool)  True on success, false on failure.

$data

(object)  The object holding the details of the new status.


Example

/**
 * Trigger event to let the plugins be notified every time the status of the orders change.
 *
 * @param  boolean  $status  True on success, false on failure.
 * @param  object   $data    The order status details.
 */
add_filter('vikappointments_status_change_packageorder', function($status, $data)
{
    /**
     * @todo do stuff when the status changes
     */

    return $status;
}, 10, 2);

Changelog

Version Description
1.2 Introduced.
Last Update: 2021-08-23
Helpful?