Created
August 13, 2024 21:30
-
-
Save kartikparmar/9feab4134e5d5b9ed5ea8d97b9709909 to your computer and use it in GitHub Desktop.
Allow booking on disabled weekdays, in advance booking period, also ignore the manage time availability settings on backend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This function will not ignore the Advance Booking Period settings on Backend. | |
*/ | |
function bkap_advance_booking_period_callback( $abp ) { | |
return is_admin() ? 0 : $abp; | |
} | |
add_filter( 'bkap_advance_booking_period', 'bkap_advance_booking_period_callback', 10, 1 ); | |
/** | |
* This function will enable all weekdays on the backend. | |
*/ | |
function bkap_enable_all_weekdays( $booking_settings ) { | |
if ( is_admin() ) { | |
$booking_settings['booking_recurring'] = array( | |
'booking_weekday_0' => 'on', | |
'booking_weekday_1' => 'on', | |
'booking_weekday_2' => 'on', | |
'booking_weekday_3' => 'on', | |
'booking_weekday_4' => 'on', | |
'booking_weekday_5' => 'on', | |
'booking_weekday_6' => 'on', | |
); | |
} | |
return $booking_settings; | |
} | |
add_filter( 'bkap_init_parameter_localize_script_booking_settings', 'bkap_enable_all_weekdays', 10, 1 ); | |
/** | |
* This function will ignore the manage time availability settings on the backend. | |
*/ | |
function bkap_manage_time_availability_settings( $manage_time_data, $booking_settings, $product_id ) { | |
if ( is_admin() ) { | |
return array(); | |
} | |
return $manage_time_data; | |
} | |
add_filter( 'bkap_manage_time_availability_settings', 'bkap_manage_time_availability_settings', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment