English (United Kingdom)

apply_filters( 'vikappointments_before_validate_customer_subscription', bool $subscribed, mixed $customer, array $services, mixed $checkin )

Fires before checking whether a customer owns an active subscription.


Description

This hook can be used to apply additional conditions to the subscription validation.

It can be used to skip the default system validations.

NOTE: calling $customer->isSubscribed() would result in recursion.


Parameters

$subscribed

(bool|null)  True to flag the customer as subscribed, false to flag it as expired or not yet subscribed, null to rely on the default system.

$customer

(VAPCustomer)  The object holding the customer details.

$id

(array)  A list of services to check.

$checkin

(string)  An optional check-in date (UTC).


Example

/**
 * This hook can be used to apply additional conditions to the subscription validation.
 * It can be used to skip the default system validations.
 *
 * @param  mixed        $subscribed  True to flag the customer as subscribed, false to flag it as
 *                                   expired or not yet subscribed, null to rely on the default system.
 * @param  VAPCustomer  $customer    The customer details.
 * @param  array        $services    A list of services to check.
 * @param  mixed        $checkin     An optional check-in date (UTC). 
 */
add_filter('vikappointments_before_validate_customer_subscription', function($subscribed, $customer, $id, $checkin)
{
    /**
     * @todo here it is possible to intercept the default validation method
     */

    return $subscribed;
}, 10, 4);

Changelog

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