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 Set Up a Staging Environment for Your WooCommerce Restaurant Website: Safely Test Menu Changes, Plugin Updates, and Checkout Fixes Without Breaking Your Live Ordering System (Complete Guide)

What Is a Staging Site and Why Every WooCommerce Restaurant Needs One Picture this: it’s Friday at 6:30 PM. Your restaurant is slammed with online orders, and you decide to quickly update your menu plugin. The screen goes white. Your checkout page throws a fatal error. For the next 45 minutes — during your most […]
April 8, 2026
Tutorials

How to Set Up Automated Backup and Disaster Recovery for Your WooCommerce Restaurant Website: Protect Orders, Menus, and Customer Data from Crashes, Hacks, and Human Error (Complete Guide)

Why Restaurant Websites Need a Bulletproof Backup Strategy Picture this: it’s 6:30 PM on a Friday, your busiest night of the week. Orders are pouring in through your WooCommerce restaurant site, the kitchen is humming, and then — nothing. Your website goes dark. Maybe a plugin update went sideways. Maybe your hosting provider had a […]
April 7, 2026
Tutorials

How to Build a Customer Loyalty and Rewards Program for Your WooCommerce Restaurant: Points, Punch Cards, and VIP Tiers to Drive Repeat Orders (Complete Guide)

Why Restaurant Loyalty Programs Matter for Online Ordering A customer places their first order through your restaurant’s website. The food arrives hot, the experience is seamless, and they’re satisfied. But will they come back? Without a deliberate strategy to encourage repeat visits, there’s a strong chance they’ll drift to a competitor or default back to […]
April 7, 2026