As you are using plugin, you need to override plugin functionality using hooks.
So, in your case, we need to override date picker functionality in your theme’s functions.php
file.
unavailableDates
is a variable where you need to pass the dates that need to be disable and other functional code indicate that you need to destroy current date picker function and re-initiate the date picker function as per your requirement using wp_footer
hook.
Below is the code snippet that i have created and it is fully logical.
add_action('wp_footer', 'wp_footer_callback');
function wp_footer_callback(){
?>
<script type="text/javascript">
jQuery(document).on('ready', function(){
var unavailableDates = ["17-12-2019", "19-12-2019", "15-12-2019"];
function unavailable(date) {
dmy = date.getDate() + "-" + (date.getMonth() + 1) + "-" + date.getFullYear();
if (jQuery.inArray(dmy, unavailableDates) == -1) {
return [true, ""];
} else {
return [false, "", "Unavailable"];
}
}
jQuery(".checkout-date-picker").datepicker("destroy");
jQuery(".checkout-date-picker").datepicker({
dateFormat: 'dd MM yy',
beforeShowDay: unavailable
});
});
</script>
<?php
}
Let me know if it does not help.