# Store Vacation Mode

> Pauses all purchasing between two dates and shows a store-wide notice explaining when you will be back, while the catalog stays online.

- Type: PHP
- Runs: Run everywhere
- Category: [WooCommerce](https://wpide.com/library/category/woocommerce/)
- Requires: WooCommerce
- Tags: woocommerce, vacation, notice, store
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-vacation-mode/

## Code

```php
$wpide_vacation = array(
    'start'   => '2026-12-23',   // First day closed (YYYY-MM-DD).
    'end'     => '2027-01-02',   // Last day closed.
    'message' => 'We are on a short break. Orders placed now will ship after January 3.',
);

$wpide_on_vacation = function () use ( $wpide_vacation ) {
    $today = wp_date( 'Y-m-d' );

    return $today >= $wpide_vacation['start'] && $today <= $wpide_vacation['end'];
};

add_filter( 'woocommerce_is_purchasable', function ( $purchasable ) use ( $wpide_on_vacation ) {
    return $wpide_on_vacation() ? false : $purchasable;
}, 99 );

add_filter( 'woocommerce_variation_is_purchasable', function ( $purchasable ) use ( $wpide_on_vacation ) {
    return $wpide_on_vacation() ? false : $purchasable;
}, 99 );

add_action( 'wp_body_open', function () use ( $wpide_on_vacation, $wpide_vacation ) {
    if ( $wpide_on_vacation() ) {
        echo '<div class="wpide-vacation-notice" style="padding:10px 16px;background:#fcf9e8;border-bottom:1px solid #dba617;text-align:center;">' . esc_html( $wpide_vacation['message'] ) . '</div>';
    }
} );
```

## Notes

Dates use the site timezone. Purchasing resumes automatically after $end.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Store Vacation Mode" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
