I can not isolate the hook to make a partial_booked day change the day to fully_booked once a customer places an order for that day... I want to only allow one booking per day yet there must be the option to select any hour of the day for start_time (between 8AM and 9PM).
I have tried several Availability settings in the product editor and even by using priorities for multiple selections of hour block or using a buffer, there is no option to create a datepicker output of fully_booked
once the customer picks the hour they want to book. (We are delivering product and can only deliver one a day... but there has to be a time to choose when to deliver so we can not make the product Availability block all day "selectable.")
What I have tried:
$booking_form_params = array('ajax_url' => WC()->ajax_url(),
'i18n_date_partially_booked' => __('This date is unavailable',
'woocommerce-bookings'),
@uses add_filter( 'booking_form_params' .... );
(this works on the front end perfectly well but the datepicker still allows clicking event if time left in the day) So of course I tried:
$htm .= '.single.single-product td.partial_booked[data-event="click"] *{
pointer-events: unset; cursor:not-allowed !important;
background: #c96259!important;}';
wp_register_style( 'codeoctober-entry-set', false );
wp_enqueue_style( 'codeoctober-entry-set' );
wp_add_inline_style( 'codeoctober-entry-set', $htm );
}
@using add_action( 'wp_footer', .... ); and add_action('wp_enqueue_scripts'....);
wp_enqueue_scripts
works great and makes the entire day field (td > a div) of calendar turn a nice bright red... But I still have that pesky click available.
So next I tried:
Some inline javascript in about a dozen different fashions and each time I tried to .removeClass
or .addClass()
or even .replace(regex)
in hopes that the td anchor would honor my request to remove the bookable
class. Results: nada!
If I could remove the bookable class then I am good to go. We just do not want any one to select a day if another customer has booked any block of time (minimum blocks are four hours).
Was hoping it was as simple as this:
add_filter( 'wc_bookings_date_picker_args', 'function-name');
function-name
{ $booked =
$wc_bookings_date_picker_args->booking_form->product->get_id() );
return array(
'partially_booked_days' => $booked['fully_booked_days'],
);
}
Here is the workaround.
And then messages customized for event: