I have modified the plugin BirchPress to not require someone to enter in a time. The first available time should auto be selected and on the front end you shouldnt see an option to choose a time. All of this looks great except when you go and submit a form it says you need to choose a time. This is the code im using. What do I need to do to fix this so it auto selects a time and has it hidden like its supposed to?
<?php
add_filter('birchschedule_view_bookingform_is_time_slots_select_field', function() {
return true;
}, 20);
?>
<?php
add_filter('birchschedule_view_bookingform_validate_booking_info', function($errors){
if(!empty($errors['birs_appointment_time']) && empty($errors['birs_appointment_date'])) {
$errors['birs_appointment_date'] = 'Date is unavailable';
unset($errors['birs_appointment_time']);
}
return $errors;
}, 20);
?>
Paste the following code in the JavaScript box.
(function($){
birchpress.addAction('birchschedule.view.bookingform.onTimeOptionsLoadAfter', function(){
$('#birs_appointment_timeoptions option:eq(1)').attr('selected', 'selected').trigger('change');
$('#birs_appointment_timeoptions').hide();
var optionsLen = $('#birs_appointment_timeoptions option').length;
if(optionsLen === 1){
$('#birs_appointment_date_error').html('Date is unavailable');
$('#birs_appointment_date_error').show();
} else {
$('#birs_appointment_date_error').html('');
$('#birs_appointment_date_error').hide();
}
});
})(jQuery);
Paste the following code in the [bpscheduler_booking_form] box.
#birs_appointment_form .birs_form_field.birs_appointment_time > label {
display: none;
}
#birs_appointment_form #birs_appointment_timeoptions {
border: none;
}
</div>