Black Friday & Cyber Monday SUPER SALE ALL WEEK:
Grab 40% OFF on plugins
Days
Hours
Minutes
Seconds

How to consider holidays in delivery preparation time?

Some businesses like online landscape supplies, food catering shops where they do not do delivery on certain days like holidays. But they do want to include those holidays in delivery preparation time as they are still open on those days for regular work, but just not delivering.

Such clients face an issue from the Order Delivery Date Pro for WooCommerce plugin where the holidays on which they do not deliver the products are excluded from the delivery preparation time set using the “Minimum Delivery Time(in hours)” option.

So for example, if a user visits the website on a holiday say 19th May and the Minimum Delivery time(in hours) is set to 24 hours. In such cases, the first available day for the delivery will be 21st May and not 20th May. That happens as the Minimum Delivery Time gets counted from the first enabled day, which is 20th May and not 19th May.

Minimum Delivery Time (in_Hours)
Minimum Delivery Time (in Hours)
Holiday Set
Holiday Set
Problem when holidays are not considered
Problem when holidays are not considered

Similarly, for clients having businesses where they do take orders on holidays, but they do not deliver on those days, hence they set them as holidays for the calendar. If such businesses still want to deliver the order on the first available day when there is a holiday between the current date and the selected delivery date, for them the holiday dates should be considered in the delivery preparation time.

This issue can now be overcome by using a hook orddd_to_calculate_minimum_hours_for_holidays from the plugin. This hook allows considering holidays in the delivery preparation time which is set using the Minimum Delivery Time (in hours) option.

Adding the below part of code in functions.php file of the active theme or any other file as per your needs will start considering the holidays in delivery preparation time:

add_filter('orddd_to_calculate_minimum_hours_for_holidays', 'orddd_calculate_minimum_hours_for_holidays');
function orddd_calculate_minimum_hours_for_holidays( $to_calculate ) {
       return 'yes';
}
Calendar after using the hook
Calendar after using the hook

Thus, by using the above hook, we have only considered 19th May as unavailable for delivery, but it’s still a working day for your back office & hence the first available date for delivery is taken as 20th May instead of 21st May.

There are many more hooks and filters available for the Order Delivery Date Pro for WooCommerce plugin that allow you to customize the plugin.

If you can’t find a hook or filter you are looking for, please suggest us & we will be happy to add those.

Browse more in: Documentation, How Tos, Order Delivery Date, WooCommerce

Share It:

Subscribe
Notify of
4 Comments
Newest
Oldest
Inline Feedbacks
View all comments
Yoni
8 years ago
Reply to  Moxa Jogani

Hi, I missed your response when you posted it. But it looks to me like the answer is no, there’s not a straightforward way to do this. I imagine it’s gotta be possible somehow by enqueuing some JavaScript, though I’m relatively inexperienced at frontend WordPress development. I guess it might be doable through adding some settings tabs too, but I’ll have to eventually look at your code to see how easily I can pull it off. I suppose I should call this a feature request, then. It seems to me that if you’re already making a partial distinction between the… Read more »

Yoni
8 years ago

What if I have the opposite issue? In my foodservice business, people can place special orders for pickup. Our business is open 7 days a week, but our production staff is only in on weekdays. So if something takes 48 hours and a customer orders on Wednesday night, they can choose Sunday pickup. But if they order on Friday morning they can’t, because our production staff doesn’t have the time. Do any of your hooks allow me to adjust availability based on production holidays instead of delivery holidays? (I am the business owner but also capable of doing some of… Read more »

4
0
Would love your thoughts, please comment.x
()
x