WPSlash

How to Disable Actions and Show an Overlay When Your WooCommerce Store is Closed

Thursday June 2, 2022

If you’re running a WooCommerce restaurant ordering system, you may want to disable ordering and display an overlay when your store is closed or not accepting orders. This ensures that customers know when ordering is unavailable, improving the user experience.

In this guide, we’ll show you how to use a simple PHP snippet to automatically disable WooCommerce orders and display an overlay notification when the store is closed.


Why Disable Actions and Show an Overlay When the Store is Closed?

✔ Prevents customers from placing orders when your restaurant is not operating
✔ Enhances the user experience by providing clear availability updates
✔ Avoids confusion and reduces customer complaints about unexpected order closures
✔ Improves order management for restaurants using WooCommerce

For WooCommerce food delivery websites, this feature is especially useful when using a dedicated ordering plugin like WooFood.


How to Show an Overlay When the Store is Closed in WooFood

To display a store closed overlay when orders are disabled in WooFood, add the following PHP snippet to your theme’s functions.php file:

<?php
add_action( 'wp_footer', 'wpslash_woofood_disabled_store_overlay');

function wpslash_woofood_disabled_store_overlay()
{
   $woofood_options = get_option('woofood_options');
  $order_types = woofood_get_order_types();
  $default_order_type=woofood_get_default_order_type();
  $order_types_enabled_now = array();
  foreach( $order_types as $order_type => $order_type_name)
  {
    $is_enabed = isset($woofood_options["woofood_force_disable_".$order_type."_option"]) ? $woofood_options["woofood_force_disable_".$order_type."_option"] : null;
    if(!$is_enabed)
    {
       $order_types_enabled_now[$order_type] =true;
    }


  }

  if(empty($order_types_enabled_now))
  {
    ?>
<div class="woofood-disabled-overlay">
    <div class="woofood-overlay-content-disabled">
       <?php echo apply_filters('woofood_disabled_overlay_message', esc_html__('Store is currently disabled..', 'woofood-plugin')); ?>
    </div>
    </div>
    <?php
  }


}
?>

How This Code Works

✅ The function wpslash_woofood_disabled_store_overlay() checks whether WooFood ordering is currently disabled.
✅ If all order types (delivery and takeaway) are disabled, it displays an overlay message.
✅ The overlay appears on all pages, preventing users from placing orders.
✅ The CSS styles make the overlay visually clear, with a background notification.


Best Practices for Implementing the Store Closed Overlay

🔹 Customize the overlay message using the WooFood filter hook woofood_disabled_overlay_message.
🔹 Modify the CSS styles to match your restaurant’s branding.
🔹 Test the feature on a staging website before deploying it to your live WooCommerce store.


Looking for an Advanced WooCommerce Food Delivery Solution?

Managing restaurant orders on WooCommerce can be challenging, especially when handling delivery schedules, order restrictions, and customer notifications. If you want a complete restaurant ordering systemWooFood is the best choice.

Why Choose WooFood?

✅ Full WooCommerce integration – Manage all orders from your WordPress dashboard.
✅ Flexible ordering options – Accept both pickup and delivery orders.
✅ Schedule-based ordering – Automatically disable orders when your restaurant is closed.
✅ Custom delivery zones – Set delivery distance restrictions and fees.
✅ Automatic order printing – Print orders instantly for faster kitchen processing.

🚀 Upgrade Your Restaurant’s Ordering System Today!

👉 Check out WooFood – The Ultimate WooCommerce Food Delivery Plugin

Leave a Comment

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

Related Articles

Restaurants Tutorials

The Cheapest Food Delivery App for Restaurants Isn’t an App at All — It’s WooFood

When restaurant owners start looking for the cheapest food delivery app, they quickly discover a frustrating truth: most “cheap” delivery platforms aren’t cheap at all. They either take commissions, charge high monthly fees, lock you into their payment processors, or limit how much control you have over your own customer base. But what if the […]
December 1, 2025
Restaurants WooFood

Why “Free” GloriaFood Might Not Be The Best Long-Term Bet For Your Restaurant

When you’re building an online ordering system for your restaurant, it’s tempting to go for a “free” solution. That’s exactly what GloriaFood offers: a ready-to-go, easy-to-install WordPress plugin for online ordering, delivery, and reservations with no setup fees or commissions But “free” doesn’t always mean “best,” especially when you’re serious about owning your brand, your […]
December 1, 2025
Tutorials WooCommerce

How to Choose the Best Food Ordering System for Your Restaurant (And Why WooFood is the Ultimate Solution)

If you’re running a restaurant, café, or fast-food business in today’s digital age, offering online food ordering is no longer optional — it’s essential. Customers expect the convenience of browsing your menu, customizing their orders, and checking out seamlessly from their phone or computer. But with so many plugins and systems available, how do you choose the right […]
April 21, 2025