WPSlash

How to Dynamically Change Delivery Time Based on the Day in WooCommerce

Thursday May 27, 2021

For restaurants and food delivery businesses, adjusting delivery and pickup times based on the day of the week is crucial for efficient order management. Some days may have higher order volumes, requiring longer preparation times, while others may allow for faster deliveries.

With WooFood – the ultimate WooCommerce food ordering plugin, you can easily modify delivery times dynamically using a custom PHP snippet.

In this guide, we’ll show you how to automatically adjust WooCommerce delivery times based on the current day.


Why Adjust Delivery Time Dynamically?

✔ Improves restaurant efficiency – Helps businesses manage peak-hour rush efficiently.
✔ Enhances customer satisfaction – Provides more accurate delivery estimates.
✔ Automates delivery settings – No need for manual adjustments each day.
✔ Seamless integration with WooCommerce – Works smoothly with the WooFood plugin.


How to Change WooCommerce Delivery Time Based on the Day Name

To dynamically adjust pickup and delivery times, insert the following PHP snippet into your child theme’s functions.php file:

add_filter( 'woofood_adjust_delivery_time_thankyou', 'wpslash_custom_hook_dynamically_change_pickup_time', 10, 2 );
add_filter( 'woofood_adjust_pickup_time_thankyou', 'wpslash_custom_hook_dynamically_change_pickup_time', 10, 2 );
function wpslash_custom_hook_dynamically_change_pickup_time( $time, $order_id ) {
	$current_day_name= current_time("l");


	if($current_day_name == "Monday")
	{
		 return "45";
	}
	if($current_day_name == "Tuesday")
	{
		 return "30";
	}
	if($current_day_name == "Wednesday")
	{
		 return "60";
	}


    return $time;
}

How This Code Works

✅ Uses current_time("l") to detect the current day of the week.
✅ Modifies the delivery and pickup time dynamically.
✅ Applies the adjusted time at checkout and order confirmation.
✅ Works seamlessly with WooCommerce food ordering systems.


Best Practices for Implementing Dynamic Delivery Times

🔹 Customize time values to match your restaurant’s workflow.
🔹 Add more conditions if you want different times for additional days.
🔹 Test the function in a staging environment before applying it to your live store.


Enhance Your WooCommerce Food Ordering System with WooFood

Managing food delivery and pickup schedules effectively is essential for smooth restaurant operations. Instead of manually adjusting delivery hours, you can automate everything with a fully-featured WooCommerce restaurant plugin like WooFood.

Why Choose WooFood?

✅ Customizable delivery schedules – Set different pickup and delivery times for each day.
✅ Flexible restaurant ordering system – Works for takeaway, delivery, and dine-in.
✅ Live order tracking & notifications – Improve customer experience with real-time updates.
✅ Automatic order printing – Send orders directly to the kitchen without delays.

🚀 Optimize Your WooCommerce Food Delivery System Today!

👉 Discover WooFood – The Best WooCommerce Food Ordering Plugin and take your restaurant business to the next level!

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Articles

WooFood

How to Disable Coupons for Delivery Orders in WooCommerce

If you’re running a WooCommerce-powered restaurant or food delivery service, you might want to restrict certain coupon codes for delivery orders while keeping them valid for pickup orders. This ensures better control over discounts, prevents misuse, and improves your store’s pricing strategy. Why Restrict Coupons for Delivery Orders? Offering coupons is a great way to attract customers, but in food […]
June 20, 2023
WooFood

How to Automatically Re-Enable Disabled Products in WooFood Once a Day

If you’re running a WooCommerce-powered restaurant ordering system using WooFood, you might have products that automatically get disabled due to stock limits or availability settings. To ensure a smooth customer experience, you can automate the re-enabling process using a scheduled WordPress cron job. This method allows you to reset all product availability once a day, ensuring your menu stays active without manual intervention. Why […]
March 8, 2023
WooFood

How to Add Live Product Search to WooFood in WooCommerce

Enhancing the user experience of your WooCommerce-powered restaurant ordering system is crucial, and adding a live product search feature can significantly improve navigation. This feature allows customers to quickly find food items in your WooFood-powered menu without manually browsing through categories. In this article, we’ll show you how to integrate a live product search above the accordion menu in WooFood using a simple jQuery script and PHP snippet. […]
December 29, 2022