Is there a hook for pending bookings that expire?

Is there an available hook for pending bookings that have not been confirmed or declined and expire or are about to expire?

Hi,

If you mean expired, which is like not paid, we recommend using the hivepress/v1/models/booking/update_status hook. Then you can check there if the draft is old status and the new one is trash, then it’s expired.

​I hope this is helpful to you.

I’m not using marketplace, so no payment for bookings. Can I use this hook to execute a function when the pending booking expires (not confirmed or declined by vendor) and goes from pending status to trash? Like so?

add_action('hivepress/v1/models/booking/update_status', 'handle_expired_booking', 10, 3);
function handle_expired_booking($booking_id, $old_status, $new_status) {
    if ($old_status === 'draft' && $new_status === 'trash') {
        $booking_post = get_post($booking_id);
        if (!$booking_post) return;

        $vendor_user_id = get_post_field('post_author', $booking_post->post_parent);
        increment_fail_count($vendor_user_id);
    }
}

Hi,

The hook itself and the PHP snippet look good, but then you need to modify this custom code. Please note that the vendor ID is not the post author of the booking; you need to go through the listing (post_parent field) and then the post_author of the listing.

I hope this information proves useful to you.

P.S. If you purchased a theme or extension, please enter the license key in the forum profile settings, this will enable the Premium Support badge and ensure a 24-hour turnaround time.