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 Set Up Email Marketing Automation for Your WooCommerce Restaurant: Abandoned Cart Recovery, Post-Order Follow-Ups, and Promotional Campaigns with Mailchimp and AutomateWoo (Complete Guide)

Why Email Marketing Is Essential for WooCommerce Restaurants A customer places an order from your restaurant on a Tuesday night, enjoys the meal, and then… disappears. Not because the food was bad, but because nothing reminded them to come back. This is the reality for most restaurants operating without email marketing automation — and it’s […]
April 6, 2026
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