Here is way to programmatically check the availability of specific dates and times for any booking resource.
You can use the `wpbc_api_is_dates_booked` function for this purpose.
Here’s an example of how to check a time slot on 2027-08-24 from 15:00 to 16:00 for booking resource with ID = 3:
$booking = array(
'dates' => array( '2027-08-24 15:00:01', '2027-08-24 16:00:02' ),
'resource_id' => 3,
'params' => array( 'is_use_booking_recurrent_time' => false ),
);
$is_dates_booked = wpbc_api_is_dates_booked( $booking['dates'], $booking['resource_id'], $booking['params'] );
if ( $is_dates_booked ) {
// Booked.
} else {
// Available.
}
And here’s an example for checking several full dates (2027-08-24, 2027-08-25, and 2027-08-26) for booking resource with ID = 3:
$booking = array(
'dates' => array( '2027-08-24 00:00:00', '2027-08-25 00:00:00', '2027-08-26 00:00:00' ),
'resource_id' => 3,
'params' => array( 'is_use_booking_recurrent_time' => false ),
);
$is_dates_booked = wpbc_api_is_dates_booked( $booking['dates'], $booking['resource_id'], $booking['params'] );
if ( $is_dates_booked ) {
// Booked.
} else {
// Available.
}