WPSlash

Add Custom Message on Availability Checker Response

Friday January 8, 2021
add_filter('woofood_availability_checker_after_response', 'woofood_hook_add_message_after_availability_checker', 10, 4);

function woofood_hook_add_message_after_availability_checker($default, $order_type, $available, $billing_postcode)
{

	$minimum = array();
    //add postal code to array with value the minimum amount without spances//
    $minimum["5722"] = 20;
    $minimum["3423"] = 30;
    $minimum["3425"] = 40;
    $minimum["3427"] = 40;
    $minimum["3424"] = 40;
    $minimum["3426"] = 50;
    $minimum["3473"] = 60;
	
	if ( $order_type == "delivery") {


    if (array_key_exists($billing_postcode, $minimum)  )
    {
		return "Minimum Delivery is ". wc_price($minimum[$billing_postcode]);
         

    }
    else if(!array_key_exists($billing_postcode, $minimum))
    {
        return "Sorry We are not delivering to this postal code";
    }

      

    }
	
}

Leave a Comment

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

Related Articles

Tutorials

How to Speed Up Your WordPress Restaurant Website: Image Optimization, Caching, Database Cleanup, and Core Web Vitals Fixes for Faster Menu Loading and Checkout (Complete Guide)

Why Restaurant Website Speed Matters More Than You Think A hungry customer pulls up your restaurant’s website on their phone during a lunch break. They’ve got maybe 15 minutes to place an order for pickup. Your homepage takes four seconds to load, the menu images trickle in one by one, and the checkout page freezes […]
April 5, 2026
Tutorials

How to Make Your WooCommerce Restaurant Ordering Website ADA Compliant and Accessible: Screen Reader Optimization, Keyboard Navigation, and WCAG 2.1 Guidelines for Online Menus and Checkout (Complete Guide)

Why Accessibility and ADA Compliance Matter for Restaurant Ordering Websites A customer with low vision tries to order dinner from your restaurant website. They navigate to your menu, but their screen reader can’t parse the item names because they’re embedded in images without alt text. The “Add to Cart” button is invisible to keyboard navigation. […]
April 5, 2026
Tutorials

How to Add Restaurant Schema Markup to Your WordPress Menu Pages: Rich Snippets for Menu Items, Pricing, Reviews, and Cuisine Type to Boost Click-Through Rates in Google Search (Complete Guide)

What Is Restaurant Schema Markup and Why It Matters for Your WordPress Food Ordering Site When someone searches “best margherita pizza near me,” Google doesn’t just show ten blue links anymore. It pulls star ratings, price ranges, cuisine types, and even individual menu items directly into the search results. That extra visual information — called […]
April 5, 2026