How to Redirect User When Woocommerce Store is Closed/Offline

If you decide to close your shop during your absence i.e. put it offline, you shouldn’t simply shut down the server or your website is temporarily closed for maintenance or it can be offline for any design changes, updating any portion of your website, or resolving any technical problem but you don’t want to upset your visitots to leave your site. so what to do.

In this situation you should create a beautiful landing page to give your visitors heads up on the ongoing activity. That’s essential to prevent them from irritating experience.

Here is my code. Add below code at the end of your theme’s functions.php file of your active child theme (or theme) and Save the file to redirect the visitors to the custom-designed landing page of your choice.

function store_closed(){
    if (!is_admin() && is_woocommerce()){
        wp_redirect('/store-closed/'); // Change store-closed to permalink you'd like to use
Scroll to Top