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 Build a Customer Loyalty Program for Your WordPress Restaurant Website (2025)

Why Loyalty Programs Matter for Restaurants With Online Ordering Here’s a number that should stop every restaurant owner in their tracks: acquiring a new customer costs five to seven times more than retaining an existing one. According to research from Bain & Company, increasing customer retention by just 5% can boost profits by 25% to […]
April 29, 2026
Tutorials

How to Speed Up Your WooCommerce Restaurant Website: Performance Optimization Tips (2025)

Why Website Speed Matters for Restaurant Ordering (And How It Affects Your Revenue) A hungry customer pulls up your <a href="https://www.wpslash.com/how-to-rank-your-restaurant-website-on-google-local-seo-for-wordpress-2025/" title="How to Rank Your Restaurant Website on Google: Local SEO for WordPress (2025)”>restaurant website on their phone, ready to place a delivery order. The page takes five seconds to load. They leave and order […]
April 29, 2026
Tutorials

How to Connect Your WordPress Restaurant Website to DoorDash, Uber Eats & Grubhub (2025)

Why Integrating Third-Party Delivery Platforms With Your Restaurant Website Matters Running a restaurant in 2025 means juggling a brutal reality: third-party delivery platforms like DoorDash, Uber Eats, and Grubhub command enormous consumer attention, but they charge commission fees that typically range from 15% to 30% per order. On a $40 delivery order, that’s $6 to […]
April 29, 2026