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 system, WooFood 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