WPSlash

Dynamically Change Average Delivery/Pickup Time Based on Store

Monday January 18, 2021

The following snippet will help you dynamically change the Average Delivery/Pickup time based on Store ID , so you will be able to set different delivery time for each location .

Copy and paste the following snippet to your functions.php and adjust it to your needs

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 ) {
	$store_id = intval(get_post_meta($order_id, 'extra_store_name', true));

	if($store_id == 1698)
	{
		 return "45";
	}
	if($store_id == 2688)
	{
		 return "30";
	}
	if($store_id == 2689)
	{
		 return "60";
	}


    return $time;
}

You can use also the following snippet to adjust also the time slots on checkout page to calculate each store average delivery time

add_filter( 'woofood_adjust_pickup_time_multistore_checkout', 'wpslash_custom_hook_dynamically_change_pickup_time_checkout', 10, 2 );
add_filter( 'woofood_adjust_delivery_time_multistore_checkout', 'wpslash_custom_hook_dynamically_change_pickup_time_checkout', 10, 2 );
function wpslash_custom_hook_dynamically_change_pickup_time_checkout( $time, $store_id ) {

	if($store_id == 1698)
	{
		 return "45";
	}
	if($store_id == 2688)
	{
		 return "30";
	}
	if($store_id == 2689)
	{
		 return "60";
	}
 
}

Leave a Comment

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

Related Articles

Tutorials

How to Configure Allergen Disclosures, Tax Rules, and ADA Accessibility Compliance for Your WooCommerce Restaurant Ordering Website (Complete Legal Compliance Guide)

Why Legal Compliance Matters for Online Restaurant Ordering Sites Running a restaurant website isn’t just about beautiful food photos and a smooth checkout. The moment you accept orders online, you step into a regulatory landscape that spans food safety law, tax code, disability rights, and data privacy — often simultaneously. And the consequences of getting […]
March 30, 2026
Tutorials

How to Manage Restaurant Inventory and Track Stock Levels with WooCommerce: A Complete Guide to Reducing Food Waste and Avoiding Sold-Out Menu Items

Why Inventory Management Matters for Restaurants Using WooCommerce A restaurant running out of its most popular dish during a Friday dinner rush isn’t just an inconvenience — it’s a direct hit to revenue and customer trust. Unlike a clothing store where unsold stock sits on shelves for months, restaurants deal with ingredients that spoil in […]
March 30, 2026
Tutorials

How to Build a Progressive Web App (PWA) for Your Restaurant Ordering Website: Turn Your WooCommerce Site into a Mobile App Experience (Complete Step-by-Step Guide)

Your customers are already ordering food on their phones. The question is whether your restaurant’s website feels like a clunky webpage or a smooth, app-like experience. Progressive Web Apps (PWAs) bridge that gap — giving your WooCommerce restaurant site the speed, reliability, and engagement of a native mobile app without the hefty development costs or […]
March 29, 2026