If you’re using WooFood – the WooCommerce food delivery plugin, you may want to set different minimum order amounts depending on the location. This is especially useful for restaurants with multiple branches or different delivery zones, ensuring that delivery costs are covered efficiently.
In this guide, we’ll show you how to use a simple WooCommerce hook to set custom minimum delivery amounts per location using a code snippet in your WordPress child theme’s functions.php
file.
Why Set a Minimum Delivery Amount Per Location?
✔ Custom pricing for different areas – Prevents low-value orders in high-cost delivery zones.
✔ Supports multiple store locations – Assign a different minimum order amount for each branch.
✔ Ensures profitability – Encourages larger orders for more distant locations.
✔ Seamless WooCommerce integration – Works perfectly with the WooFood plugin.
This setup is ideal for restaurant chains, multi-location businesses, and WooCommerce stores that offer delivery to different regions.
How to Set Different Minimum Delivery Amounts Per Location in WooFood
To customize the minimum order amount for each store location, add the following PHP snippet to your theme’s functions.php
file:
<?php
add_action( 'woocommerce_checkout_process', 'woofood_custom_hook_minimum_per_store', 9999999 );
function woofood_custom_hook_minimum_per_store() {
global $woocommerce;
if (isset($_POST["extra_store_name"])) {
//35 is the store id //
if ($_POST["extra_store_name"] == "35")
{
wc_add_notice(
sprintf( __( 'You must have an order with a minimum of %s to place your order, your current order total is %s.', 'woofood-plugin' ) ,
wc_price( 20 ),
wc_price( WC()->cart->subtotal )
), 'error'
);
}
//34 is the store id //
else if($_POST["extra_store_name"] == "34")
{
wc_add_notice(
sprintf( __( 'You must have an order with a minimum of %s to place your order, your current order total is %s.', 'woofood-plugin' ) ,
wc_price( 25 ),
wc_price( WC()->cart->subtotal )
), 'error'
);
}
}
}
?>
How This Code Works
✅ The woocommerce_checkout_process
hook ensures the minimum order validation happens during checkout.
✅ The function woofood_custom_hook_minimum_per_store()
checks the store ID selected by the customer.
✅ Different minimum order amounts are applied based on the store location.
✅ If the customer’s order subtotal is below the required minimum, an error message prevents checkout.
Best Practices for Implementing Location-Based Minimum Delivery Amounts
🔹 Ensure your store locations are properly configured in WooFood.
🔹 Modify store IDs and minimum order values to match your restaurant’s requirements.
🔹 Test the code in a staging environment before deploying it to your live site.
🔹 Combine this feature with delivery zone-based pricing for more accurate delivery cost control.
Looking for a Complete WooCommerce Food Delivery Solution?
If you’re running a restaurant or food delivery business with multiple locations, you need a robust WooCommerce food ordering plugin that supports:
✅ Custom delivery pricing per location
✅ Minimum order restrictions based on delivery zones
✅ Pickup and delivery order management
✅ Real-time order processing
With WooFood – WooCommerce Food Delivery Plugin, you can fully automate your restaurant’s online ordering system, optimize the checkout process, and increase revenue with custom pricing strategies.
🚀 Upgrade Your WooCommerce Food Ordering System Today!
👉 Get WooFood here and take your restaurant website to the next level!