English (United Kingdom)

apply_filters( 'vikappointments_validate_zip_code', bool $status, string $zip, array $accepted, int $id_employee, array $services )

Fires while validating a ZIP code.


Description

It is possible to use this hook to enhance or change the default algorithm while checking whether a specific ZIP code is allowed or not.


Parameters

$status

(bool)  True to accept the ZIP code anyway, false to deny the ZIP code, null to rely on the default algorithm.

$zip

(string)  The ZIP code to validate.

$accepted

(array)  An array of accepted ZIP codes, built as:

[
    {
        "from": "65000",
        "to": "65010"
    },
    {
        "from": "62156",
        "to": "62156"
    }
]
$id_employee

(int)  The ID of the booked employee. In case the employee was not selectable this value will be lower than 0.

$services

(array)  An array of booked services.


Example

/** 
 * It is possible to use this hook to enhance or change the default algorithm
 * while checking whether a specific ZIP code is allowed or not.
 *
 * @param  boolean  $status    True to accept the ZIP code, false to deny the
 *                             ZIP Code, null to rely on the default algorithm.
 * @param  string   $zip       The ZIP code to validate.
 * @param  array    $accepted  An array of accepted ZIP codes.
 * @param  integer  $id_emp    The employee ID (0 or -1 mean global).
 * @param  array    $services  An array of booked services.
 */
add_filter('vikappointments_validate_zip_code', function($status, $zip, $accepted, $id_emp, $services)
{
    /**
     * @todo implement here your own algorithm for the ZIP codes validation
     */

    return $status;
}, 10, 5);

Changelog

Version Description
1.2 Introduced.
Last Update: 2021-10-08
Helpful?
This site uses cookies. By continuing to browse you accept their use. Further information