How to Redirect User When Woocommerce Store is Closed/Offline?

Your website is temporarily closed for maintenance. It can be offline for any design changes, updating any portion of your website, or resolving any technical problem. Now, what would you do? Will you let your visitors come to your site and irritate them with an annoying display, or handle this artistically?

The best way, and also the best practice, is to 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, We will provide you a code that you can add to your theme’s functions.php file to redirect the visitors to the custom-designed landing page of your choice. Your website will remain accessible to your team members, who will be able to view it and work on it.

Add Below Code in Functions.php File of your theme.

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

By using this code, you follow the best practices of the website development and succeed in keeping your visitors loyal and returning them happy.


Editorial Staff

ThemeLocation Provides Wordpress & Woocommerce development & Customization services. Have a Project? Contact To discuss

Leave a Reply

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