English (United Kingdom)

apply_filters_ref_array( 'vikappointments_fetch_status_save_order', bool $result, string &$status, string &$comment )

Fires after evaluating the default status code.


Description

Trigger hook to manipulate the order status at runtime.

In case you need to determine the correct status depending on the booked services, it is possible to use the following code to access all the services contained within the cart.

// get cart model
$model = JModelVAP::getInstance('cart');
// get cart instance
$cart = $model->getCart();
// iterate items list
foreach ($cart->getItemsList() as $item)
{
    // convert object into an array
    $arr = $item->toArray();
}

Parameters

$result

(bool)  True on success, false otherwise.

&$status

(string)  The status code to use.

&$comment

(string)  An optional status comment.


Example

/**
 * Trigger hook to manipulate the order status at runtime.
 *
 * @param  boolean  $result    True on success, false otherwise.
 * @param  string   &$status   The currently fetched order status.
 * @param  string   &$comment  An optional status comment to be used.
 */
add_filter('vikappointments_fetch_status_save_order', function($result, &$status, &$comment)
{
    // auto-confirm appointment
    $status = 'C';
    // define a custom comment
    $comment = 'Appointment confirmed by a third-party plugin';

    return $result;
}, 10, 3);

Changelog

Version Description
1.2 Introduced.
Last Update: 2022-04-11
Helpful?