WPSlash

How to Set Different Minimum Delivery Amounts for Each Location in WooFood

Monday June 14, 2021

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!

Leave a Comment

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

Related Articles

WooFood

How to Disable Coupons for Delivery Orders in WooCommerce

If you’re running a WooCommerce-powered restaurant or food delivery service, you might want to restrict certain coupon codes for delivery orders while keeping them valid for pickup orders. This ensures better control over discounts, prevents misuse, and improves your store’s pricing strategy. Why Restrict Coupons for Delivery Orders? Offering coupons is a great way to attract customers, but in food […]
June 20, 2023
WooFood

How to Automatically Re-Enable Disabled Products in WooFood Once a Day

If you’re running a WooCommerce-powered restaurant ordering system using WooFood, you might have products that automatically get disabled due to stock limits or availability settings. To ensure a smooth customer experience, you can automate the re-enabling process using a scheduled WordPress cron job. This method allows you to reset all product availability once a day, ensuring your menu stays active without manual intervention. Why […]
March 8, 2023
WooFood

How to Add Live Product Search to WooFood in WooCommerce

Enhancing the user experience of your WooCommerce-powered restaurant ordering system is crucial, and adding a live product search feature can significantly improve navigation. This feature allows customers to quickly find food items in your WooFood-powered menu without manually browsing through categories. In this article, we’ll show you how to integrate a live product search above the accordion menu in WooFood using a simple jQuery script and PHP snippet. […]
December 29, 2022