Last Updated on: 29th September 2017, 10:19 am
Fixed blocks of
Timelots with varying durations in the same WooCommerce Bookings product, you say? Not possible. Yes, possible with a little math.
Here is the scenario.
The required times:
• 8.15am
• 9:30am
• 12.00pm
• 2.30pm
• 5.30pm
In many bookings scenario the duration of the bookable slot is not a deciding factor. Just like in this one, only the start time counts. Since WooCommerce Bookings only allows one duration for the bookable slot you need to do a little math to make it work.
All you need is to find the highest common denominator (hcd) and then knock out the times in-between that you do not want to be available. I hope I used the correct term. English is not my first language and my math vocabulary is limited, ahem ;).
Let me illustrate:
Finding the hcd
These are the required times and their time gap in-between:
• 8.15am – 75 minutes.
• 9:30am – 150 minutes.
• 12.00pm – 150 Minutes
• 2.30pm – 180 minutes
• 5.30pm
Now for the math. Find the highest number that can be used to divide each time gap.
The answer here is 15.
75 / 15 = 5
150 / 15 = 10
180 / 15 = 12
You then set 15 as your bookable slot:
Eliminate non-required timeslots
Upon saving this will produce many, many, many bookable time slots. Now starts the elimination. As a first step set the “First Block starts at…” to your earliest required time: 08:15. This will eliminate night times.
Much better.
As you can see now, your required times are among them. Now all you need to do is to knock out the times you don’t want while preserving the duration of your bookable slot, that is 15 minutes. Like so:
Each availability rule has 15 minutes of a gap, so that your desired time slots “survive”. The last availability rule takes care of all time slots after 05:30pm until midnight.
This gives you your required times:
That is it
Hope this helps the next time you need to setup varying bookable slots for your WooCommerce Bookings product
PS: Tested with WooCommerce Bookings 1.9.15
Leave a Reply