FoodMaster calculates delivery time from the setting you configure in the admin panel — but one fixed number rarely fits every situation. Rush hour, heavy orders, special events, or VIP customers may all need a different estimate. The woofood_adjust_delivery_time filter makes it possible to change the delivery time dynamically at checkout, without touching a single plugin file.
What Is the woofood_adjust_delivery_time Filter?
The woofood_adjust_delivery_time filter runs at checkout when FoodMaster calculates how long the order will take to arrive. It receives the current delivery time in minutes (taken from your settings) and lets you return a modified value. FoodMaster then uses that modified value throughout checkout and on the order confirmation page.
Add your code to your active theme’s functions.php file or, better yet, to a small custom plugin so your changes survive theme updates.
add_filter( 'woofood_adjust_delivery_time', 'my_prefix_adjust_delivery_time' );
function my_prefix_adjust_delivery_time( $delivery_time ) {
// $delivery_time is in minutes (integer)
// Return a modified integer
return $delivery_time;
}
Practical Use Cases with Code Examples
Example 1 — Add Extra Time Based on Cart Weight
If heavy orders take longer to prepare, automatically add extra minutes based on the total cart weight.

add_filter( 'woofood_adjust_delivery_time', 'my_prefix_delivery_time_by_weight' );
function my_prefix_delivery_time_by_weight( $delivery_time ) {
$cart = WC()->cart;
if ( ! $cart ) {
return $delivery_time;
}
$cart_weight = (float) $cart->get_cart_contents_weight(); // weight in kg
if ( $cart_weight > 15 ) {
return $delivery_time + 30; // very heavy order: +30 minutes
}
if ( $cart_weight > 8 ) {
return $delivery_time + 15; // medium-heavy order: +15 minutes
}
return $delivery_time;
}
Example 2 — Add Extra Time During Peak Hours
Friday and Saturday evenings between 19:00 and 22:00 are typically the busiest. Warn customers automatically so there are no surprises.
add_filter( 'woofood_adjust_delivery_time', 'my_prefix_delivery_time_peak_hours' );
function my_prefix_delivery_time_peak_hours( $delivery_time ) {
$now = new DateTime( 'now', new DateTimeZone( wp_timezone_string() ) );
$hour = (int) $now->format( 'H' );
$day_of_week = (int) $now->format( 'N' ); // 1=Monday, 7=Sunday
// Friday (5) and Saturday (6), 19:00–22:00
if ( in_array( $day_of_week, array( 5, 6 ), true ) && $hour >= 19 && $hour < 22 ) {
return $delivery_time + 20; // add 20 minutes during peak
}
return $delivery_time;
}
Example 3 — Reduce Time for VIP Customers
Reward loyal customers who have a specific user role with a faster estimated delivery.
add_filter( 'woofood_adjust_delivery_time', 'my_prefix_delivery_time_vip' );
function my_prefix_delivery_time_vip( $delivery_time ) {
if ( ! is_user_logged_in() ) {
return $delivery_time;
}
$user = wp_get_current_user();
if ( in_array( 'vip_customer', (array) $user->roles, true ) ) {
return max( 15, $delivery_time - 15 ); // subtract 15 min, minimum 15 min
}
return $delivery_time;
}
Example 4 — Increase Time Based on Cart Item Count
Large orders with many different items take longer to assemble. Add extra time per item above a threshold.
add_filter( 'woofood_adjust_delivery_time', 'my_prefix_delivery_time_by_item_count' );
function my_prefix_delivery_time_by_item_count( $delivery_time ) {
$cart = WC()->cart;
if ( ! $cart ) {
return $delivery_time;
}
$item_count = (int) $cart->get_cart_contents_count();
if ( $item_count >= 10 ) {
return $delivery_time + 20;
}
if ( $item_count >= 5 ) {
return $delivery_time + 10;
}
return $delivery_time;
}
Related Filters
woofood_adjust_pickup_time— Same logic applied to the pickup time estimatewoofood_adjust_dinein_time— Adjusts the dine-in service time estimatewoofood_adjust_delivery_time_thankyou— Runs on the thank-you page (also receives$order_idas second argument)woofood_delivery_time_based_on_preparation_time— Returntrueto base delivery time on product preparation times
Where to Add the Code
- Theme’s functions.php — Quick, but lost if you switch themes. Open Appearance → Theme File Editor → functions.php and paste at the bottom.
- Custom plugin (recommended) — Create
wp-content/plugins/my-woofood-tweaks/my-woofood-tweaks.phpwith a plugin header. Survives theme changes and is easier to manage.
Always return an integer from the filter. FoodMaster expects minutes as a whole number. Returning a float or string may cause unexpected display results.
Frequently Asked Questions
Does this affect the time shown on the thank-you page?
No. The checkout filter only affects the time during checkout. For the thank-you page use woofood_adjust_delivery_time_thankyou, which also receives $order_id so you can read order details.
Can I return 0 to hide the delivery time?
Returning 0 will display “0 minutes.” To completely hide the delivery time, use a separate template override or CSS.
Does it work with the multistore feature?
Use woofood_adjust_delivery_time_multistore_checkout for multistore setups — it receives the store ID as a second argument so you can apply different values per location.
Wrapping Up
The woofood_adjust_delivery_time filter is one of the most practical hooks in FoodMaster. A few lines of code can dynamically reflect real-world conditions — peak hours, order complexity, customer loyalty — and set accurate expectations that reduce complaints and build trust.
If you have questions or need help with a custom scenario, open a support ticket and our team will help you get it working.