Hello,
Yes you can, thanks to Booking Activities API.
Add this code in your child theme functions.php:
/**
* Allow to reschedule only once
* @param boolean $is_allowed
* @param int $booking_id
* @return boolean
*/
function my_theme_allow_to_reschedule_once( $is_allowed, $booking_id ) {
if( ! $is_allowed || current_user_can( 'bookacti_edit_bookings' ) ) { return $is_allowed; }
$reschedule_date = bookacti_get_metadata( 'booking', $booking_id, 'reschedule_date', true );
if( $reschedule_date ) { return false; }
return $is_allowed;
}
add_filter( 'bookacti_booking_can_be_rescheduled', 'my_theme_allow_to_reschedule_once', 20, 2 );
/**
* Keep a record when a booking is rescheduled
* @param int $booking_id
* @param array $booking
* @param array $args
*/
function my_theme_save_reschedule_date( $booking_id, $booking, $args ) {
if( current_user_can( 'bookacti_edit_bookings' ) ) { return; }
bookacti_update_metadata( 'booking', $booking_id, array( 'reschedule_date' => date( 'Y-m-d H:i:s' ) ) );
}
add_action( 'bookacti_booking_rescheduled', 'my_theme_save_reschedule_date', 20, 3 );
Regards,
Yoan Cutillas