English (United Kingdom)
Knowledge Base  >  Vik Appointments  >  Hooks  >  Packages  >  Count Remaining

apply_filters_ref_array( 'vikappointments_count_remaining_packages', bool $status, mixed &$query, int $serviceId )

Fires while counting the remaining (redeemable) packages for a specific user/order.


Description

This hook can be used to apply additional restrictions while counting the remaining number of packages that can be redeemed for the specified service.

Parameters

$status

(bool)  True on success, false otherwise.

&$query

(mixed)  Either a SQL string or a query builder object.

$serviceId

(int)  The ID of the service. 


Example

/**
 * Applies additional restrictions while counting the remaining number of packages
 * that can be redeemed for the specified service.
 *
 * @param  bool    $status     True on success, false otherwise.
 * @param  string  &$query     The database query used to count the remaining packages.
 * @param  int     $serviceId  The ID of the service that should be redeemed.
 */
add_filter('vikappointments_count_remaining_packages', function($status, &$query, $serviceId) {
    /**
     * @todo extend here the query used to count the remaining packages
     */

    return $status;
}, 10, 3);

Changelog

Version Description
1.2.11 Introduced.
Last Update: 5 days ago
Helpful?