WPSlash

How to Set a Dynamic Minimum Order Amount

Saturday February 21, 2026

The minimum order amount for delivery is easy to configure in FoodMaster’s settings — but what if you need different minimums for different customers, different times of day, or different order scenarios? The woofood_minimum_amount_delivery_filter filter lets you override the minimum dynamically in code, without changing your global settings.

What Is the woofood_minimum_amount_delivery_filter?

This filter runs every time FoodMaster checks whether the current cart meets the minimum order requirement for delivery. It receives the configured minimum amount (as a float) and lets you return a different value. The modified minimum is then used for validation at checkout and displayed in the mini-cart warning bar.

add_filter( 'woofood_minimum_amount_delivery_filter', 'my_prefix_custom_minimum' );

function my_prefix_custom_minimum( $minimum ) {
    // $minimum is a float (e.g. 15.00)
    // Return the minimum you want to enforce
    return $minimum;
}

Practical Use Cases with Code Examples

Example 1 — Lower Minimum for Logged-In Customers

FoodMaster minimum order amount filter at WooCommerce checkout

Reward registered customers with a lower minimum order threshold compared to guests.

add_filter( 'woofood_minimum_amount_delivery_filter', 'my_prefix_minimum_by_user_status' );

function my_prefix_minimum_by_user_status( $minimum ) {
    if ( is_user_logged_in() ) {
        return 10.00; // €10 for registered customers
    }

    return $minimum; // default for guests
}

Example 2 — Higher Minimum During Lunch Rush

Set a higher minimum order during peak hours to make delivery financially viable when the kitchen is busiest.

add_filter( 'woofood_minimum_amount_delivery_filter', 'my_prefix_minimum_peak_hours' );

function my_prefix_minimum_peak_hours( $minimum ) {
    $now  = new DateTime( 'now', new DateTimeZone( wp_timezone_string() ) );
    $hour = (int) $now->format( 'H' );

    // Lunch (12–14) and dinner (19–22) peak periods
    if ( ( $hour >= 12 && $hour < 14 ) || ( $hour >= 19 && $hour < 22 ) ) {
        return max( $minimum, 20.00 ); // at least €20 during peak
    }

    return $minimum;
}

Example 3 — Different Minimum by User Role

Apply different minimums per role — useful if you serve both regular consumers and wholesale/corporate clients.

add_filter( 'woofood_minimum_amount_delivery_filter', 'my_prefix_minimum_by_role' );

function my_prefix_minimum_by_role( $minimum ) {
    if ( ! is_user_logged_in() ) {
        return $minimum;
    }

    $user = wp_get_current_user();

    if ( in_array( 'wholesale_customer', (array) $user->roles, true ) ) {
        return 50.00; // €50 minimum for wholesale orders
    }

    if ( in_array( 'vip_customer', (array) $user->roles, true ) ) {
        return 8.00; // €8 minimum for VIP customers
    }

    return $minimum;
}

Example 4 — Remove Minimum for a Specific Product Category

If all items in the cart belong to a high-value category, waive the delivery minimum entirely.

add_filter( 'woofood_minimum_amount_delivery_filter', 'my_prefix_minimum_by_category' );

function my_prefix_minimum_by_category( $minimum ) {
    $cart = WC()->cart;

    if ( ! $cart || $cart->is_empty() ) {
        return $minimum;
    }

    $premium_category_slug = 'premium-dishes'; // replace with your slug

    foreach ( $cart->get_cart() as $cart_item ) {
        $product_id = $cart_item['product_id'];
        if ( ! has_term( $premium_category_slug, 'product_cat', $product_id ) ) {
            return $minimum; // at least one item is not premium, apply minimum
        }
    }

    return 0; // all items are premium — no minimum required
}

Customising the Mini-Cart Message

When a customer’s cart is below the minimum, FoodMaster shows a notice in the mini-cart. You can customise this message with the woofood_minimum_amount_reached_message_minicart filter, which receives the current message and the minimum amount as arguments.

add_filter( 'woofood_minimum_amount_reached_message_minicart', 'my_prefix_custom_minimum_message', 10, 2 );

function my_prefix_custom_minimum_message( $message, $minimum ) {
    $formatted = wc_price( $minimum );

    return sprintf(
        'Add <strong>%s</strong> more to unlock delivery for your area.',
        $formatted
    );
}

Use wc_price() to format the amount correctly for your currency and locale — it handles symbols, decimal separators, and right-to-left languages automatically.

Frequently Asked Questions

Does the filter affect pickup orders too?

No. The woofood_minimum_amount_delivery_filter only applies to delivery. Pickup orders use a separate minimum configured in the pickup settings, and there is a corresponding filter for it.

Can I return 0 to completely remove the minimum?

Yes. Returning 0 effectively removes the delivery minimum for the conditions you define, allowing customers to check out with any cart total.

Does this work with multistore?

Yes. The filter runs per checkout regardless of multistore mode. If you need store-specific minimums, you can read the current store ID from the session inside the filter callback.

Wrapping Up

Dynamic minimum order amounts let you run a smarter delivery operation — protecting margins during peak times, rewarding loyal customers, and offering flexibility to different customer segments. A few lines of code in woofood_minimum_amount_delivery_filter can handle all of these scenarios without touching the plugin settings.

Need help implementing a custom scenario? Open a support ticket and the FoodMaster team will assist you.

Leave a Comment

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