Italian (Italy)
Knowledge Base  >  Vik Appointments  >  Hook  >  Pacchetti  >  Controllare Disponibilità del Servizio

apply_filters( 'vikappointments_check_service_package_availability', bool $available, int $id_package, object $service )

Fires while checking whether a package is able to redeem a specific service.


Description

This hook can be used to apply additional conditions while checking whether a service can be redeemed by the specified package.

When this hook is triggered, the system already validated the standard conditions and the service is going to be included within the list of available services.

The system validates only the services that have been assigned to the targeted package. In case a package has no assigned services, this hook won't be triggered.


Parameters

$available

(bool)  False to mark the service as not available.

$id_package

(int)  The targeted package ID.

$service

(object)  The object holding the service details.


Example

/**
 * This hook can be used to apply additional conditions while checking whether a
 * service can be redeemed by the specified package. When this hook is triggered,
 * the system already validated the standard conditions and the service is going
 * to be included within the list of available services.
 *
 * @param  boolean  $available   Return false to flag the service as NOT available.
 * @param  integer  $id_package  The package identifier.
 * @param  object   $service     The service to check.
 */
add_filter('vikappointments_check_service_package_availability', function($available, $id_package, $service)
{
    /**
     * @todo add here further validations
     */

    return $available;
}, 10, 3);

Changelog

Version Description
1.2 Introduced.
Ultimo aggiornamento: 2021-08-21
Utile?