Store Vacation Mode

Overview

↑ Back to top

Store Vacation Mode lets you temporarily close a WooCommerce store for holidays, maintenance, or restocking without hiding it. Your pages stay online and fully indexable with normal HTTP 200 responses (SEO safe), but purchasing is disabled and a customizable notice tells customers when the store reopens. You can close the store instantly with a manual switch or schedule it between two dates in the site timezone, with no cron jobs, because the open/closed status is computed live on every request. A live status card, a customizable banner, and an admin bar badge keep you and your team informed.

Installation

↑ Back to top
  1. Upload the store-vacation-mode folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Navigate to WooCommerce > Settings > Advanced > Vacation Mode to configure

The master switch (Enable Plugin) is off by default, so activating the plugin does not close your store until you enable it.

Requirements

↑ Back to top
  • WordPress 6.4 or higher
  • WooCommerce 9.0 or higher
  • PHP 7.4 or higher

Settings

↑ Back to top

Access settings at WooCommerce > Settings > Advanced > Vacation Mode (admin.php?page=wc-settings&tab=advanced&section=vacation-mode). The settings page is a React app organized into three tabs.

General

↑ Back to top
SettingDescriptionDefault
Store StatusLive status card computed from the manual switch and the schedule. Shows OPEN or CLOSED, the reason, and the next scheduled change. Read-only; refreshed on save.n/a
Enable PluginMaster switch. When disabled, no vacation mode features, hooks, or logic are active at all.Disabled (no)
Vacation mode activeManual switch. When on, the store is closed immediately, regardless of the schedule, until switched off.Off (no)
Enable scheduleWhen enabled, the store closes between the start and end dates below.Off (no)
Start dateDatetime (site timezone) when the scheduled closure begins. Leave empty to close from now.Empty ('')
End dateDatetime (site timezone) when the scheduled closure ends. Leave empty to stay closed until reopened manually. Also feeds the {reopen_date} placeholder.Empty ('')

Message

↑ Back to top
SettingDescriptionDefault
Notice textThe message shown to customers while the store is closed. Supports the {reopen_date} placeholder and basic HTML.We are currently on vacation. Orders will resume on {reopen_date}.
Notice positionWhere the notice appears: top_bar (site-wide top bar), before_shop (before shop, cart, and checkout content), or both.both
Background colorBanner and inline notice background color.#b91c1c
Text colorBanner and inline notice text color.#ffffff

Behavior

↑ Back to top
SettingDescriptionDefault
Disable purchasingMakes products non-purchasable, removes add-to-cart buttons, and blocks checkout while the store is closed. Existing carts are kept but cannot be checked out.Enabled (yes)
Hide pricesAlso hides product prices while the store is closed.Disabled (no)
Show admin bar badgeShows a red “Vacation Mode ON” badge in the admin bar (for users who can manage WooCommerce) while the store is closed, linking to this settings page.Enabled (yes)

All settings are stored together in a single svm_settings option.

How It Works

↑ Back to top
  1. Turn on the Enable Plugin master switch in the General tab.
  2. Close the store either immediately (turn on Vacation mode active) or on a schedule (enable the schedule and set dates).
  3. While the store is closed, products are made non-purchasable, add-to-cart buttons are removed, checkout is blocked, and the vacation notice is shown according to its position.
  4. Pages continue to return HTTP 200 and stay indexable throughout; nothing is redirected to a maintenance page.
  5. Reopen by switching off the manual switch or letting the scheduled window end; the store returns to normal on the next page load.

Notice placeholder

↑ Back to top

The notice text supports a single {reopen_date} placeholder. When the schedule is enabled and an end date is set, the placeholder is replaced with the end date formatted using the site date format. When there is no end date, the placeholder is removed along with a leading preposition (on, by, from, until, after) and any leftover punctuation spacing is cleaned up, so the sentence still reads correctly.

The is_store_closed Logic

↑ Back to top

The core of the plugin is SVM_Vacation::is_store_closed(). The store is considered closed only when:

  1. The Enable Plugin master switch is on (enabled === 'yes'), AND
  2. Either:
  • The manual switch is on (vacation_active === 'yes'), in which case the store is closed immediately; OR
  • The schedule is enabled (schedule_enabled === 'yes') AND the current time falls within the configured window.

The scheduled window is evaluated by is_within_schedule() using current_datetime() (WordPress site timezone):

  • An empty start date means “from now” (no lower bound).
  • An empty end date means “until manually reopened” (no upper bound).
  • The store is closed when the current time is at or after the start date (if set) and at or before the end date (if set).

Dates are parsed from the YYYY-MM-DDTHH:MM format into a DateTimeImmutable in the site timezone (wp_timezone()). Because the status is computed live on each request, there are no WP-Cron events involved and scheduled transitions happen exactly on time.

SVM_Vacation::get_status() returns a structured status (is_closed, human-readable reason, current time, and next scheduled change) that powers the live status card and the /status REST endpoint.

Frontend Behavior While Closed

↑ Back to top

All frontend behavior is registered by SVM_Frontend only when the store is closed:

  • Disable purchasing (when enabled): filters woocommerce_is_purchasable and woocommerce_variation_is_purchasable to return false (which also blocks Store API add-to-cart), removes the loop add-to-cart link, redirects the checkout page to the cart with the notice, and rejects classic woocommerce_checkout_process submissions.
  • Hide prices (when enabled): filters woocommerce_get_price_html to return an empty string.
  • Notices: renders a site-wide top banner (on wp_body_open, with a wp_footer fallback) and/or an inline notice before shop, cart, and checkout content, depending on the notice position. Both use the configured background and text colors.

Developer Hooks

↑ Back to top

The plugin exposes two filters:

HookTypeDescription
svm_is_store_closedfilterFilter the boolean result of whether the store is currently closed. Params: $closed (bool).
svm_vacation_notice_textfilterFilter the customer notice text after {reopen_date} replacement. Params: $text (string), $settings (array).

REST API

↑ Back to top

Namespace: svm/v1. All routes require the manage_woocommerce capability.

RouteMethodsDescription
/settingsGET, POSTGet or update plugin settings
/statusGETGet the current live store status (is_closed, reason, now, next_change)

HPOS Compatibility

↑ Back to top

Store Vacation Mode declares full compatibility with WooCommerce High-Performance Order Storage (HPOS) and Cart/Checkout Blocks via FeaturesUtil::declare_compatibility for custom_order_tables and cart_checkout_blocks.

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.