Your cart is empty!
Calculate Advance Time
apply_filters( 'vikappointments_calculate_advance_time', int $value, int $advance, string $datetime, object $service )
Fires while checking whether the booking time is in the past or not.
Description
Trigger hook to let the plugins can calculate their own advance time, also known as Booking Minutes Restrictions.
In example, by returning 60, the check-in will be allowed only in case the current time plus 60 minutes is equals or lower than the selected check-in.
Parameters
- $value
-
(int) The overwritten "advance" amount (in minutes).
- $advance
-
(int) The default "advance" amount configured from the settings page.
- $datetime
-
(string) The check-in date and time.
- $service
-
(object) The details of the booked service.
Example
/**
* Trigger event to let the plugins can calculate their own advance time,
* also known as "Booking Minutes Restrictions".
* Only the highest returned value will be used, also compared to the
* default one.
*
* @param integer $value The overwritten "advance" amount (in minutes).
* @param integer $advance The default "advance" amount.
* @param string $datetime The check-in date and time.
* @param object $service The details of the booked service.
*/
add_filter('vikappointments_calculate_advance_time', function($value, $advance, $datetime, $service)
{
/**
* @todo manipulate advance time here
*/
return $value;
}, 10, 4);
Changelog
Version | Description |
---|---|
1.2.0 | The $datetime parameter is now a date string instead of a UNIX timestamp. The $service parameter has been changed from array to object. |
1.1.8 | Introduced. |
Last Update: 2021-10-05
Helpful?