Disable Actions and show an Overlay when Store is closed
June 2, 2022
TutorialsWooFood
woocommerce food orderingwordpress food ordering plugin
<?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
}
}
?>