In our Booking and Appointment plugin for WooCommerce we have provided the feature to control the availability days based on the booking product type. Let’s take a particular booking type ‘Multiple Nights’. When customers book a hotel, store owners can use the availability tab and control availability weekdays for both check-in and checkout days.
For example, in the below image if Monday is disabled this will not be shown in both check-in and checkout calendars. With this customization, we can enable specific weekdays exclusively in the checkout calendar while maintaining their disabled status in the availability tab.
Solution: Manage Weekday Availabilty in Checkout Calendar in the Booking and Appointment Plugin for WooCommerce?
The code ensures that certain weekdays disabled in the availabilty tab options will be set to be available only in check out date which helps customers to select dates more freely during checkout.
function bkap_add_additional_data( $additional_data, $booking_settings, $product_id ) { $allowed_weekdays = array( //'0', // Sunday '1', // Monday. //'2', // Tuesday //'3', // Wednesday //'4', // Thursday //'5', // Friday //'6', // Saturday ); if ( isset( $additional_data['wapbk_block_checkout_weekdays'] ) && '' !== $additional_data['wapbk_block_checkout_weekdays'] ) { $checkout_days = explode( ',', $additional_data['wapbk_block_checkout_weekdays'] ); foreach ( $allowed_weekdays as $a_w_key => $a_w_value ) { if ( ( $key = array_search( $a_w_value, $checkout_days ) ) !== false ) { unset( $checkout_days[ $key ] ); } } if ( ! empty( $checkout_days ) ) { if ( count( $checkout_days ) > 1 ) { $additional_data['wapbk_block_checkout_weekdays'] = implode( ',', $checkout_days ); } else { $checkout_days = array_values( $checkout_days ); $additional_data['wapbk_block_checkout_weekdays'] = $checkout_days[0]; } } else { $additional_data['wapbk_block_checkout_weekdays'] = ''; } } return $additional_data; } add_filter( 'bkap_add_additional_data', 'bkap_add_additional_data', 10, 3 );
Output
The output shows that the weekdays disabled in the availability tab are disabled in check in date but enabled only in the checkout calendar.
Before implementing the code, Monday weekdays will be disabled both in the check-in and check-out dates, as shown in the images below.
With custom code, you can override backend settings and precisely control functionality on the frontend as needed. Similarly, we can address specific requirements such as setting a fixed booking cost of 1-hour rate regardless of the total booking hours selected by the customer. If you have any unique needs or questions, please let us know in the comments.