Configuration
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Preorder has a deliberately small surface: two store-wide settings on one screen and one checkbox per product. There is no release-date field, no per-product button label and no “show release date” option in the plugin, if you have seen those described elsewhere, they are not part of this code.
Store-wide settings
Section titled “Store-wide settings”Open WooCommerce → Pre-orders. Both values are stored in a single option, preorder_settings, and reads are merged over the shipped defaults so a missing or partial option never breaks.
Enable pre-orders
Section titled “Enable pre-orders”Option key enabled (boolean, default true). The master switch for the whole store.
When on, every product flagged as a pre-order behaves as one: it stays purchasable while out of stock, shows the custom button label and renders the reservation stub.
When off, Preorder registers none of its storefront hooks, flagged products fall straight back to normal WooCommerce behaviour: they stop being purchasable once out of stock, the standard add-to-cart label returns, and the reservation stub disappears. The per-product flags are preserved, so flipping the switch back on restores every pre-order at once. This is the safe way to pause a launch without touching individual products.
Default button text
Section titled “Default button text”Option key default_button_text (string, default Pre-order now). The add-to-cart label shown on every pre-order product, applied through WooCommerce’s woocommerce_product_single_add_to_cart_text and woocommerce_product_add_to_cart_text filters.
Leave it blank and Preorder falls back to Pre-order now, an empty value never produces a blank button. The settings screen shows a live preview of the label as you type; the preview is presentation only and does not change anything until you save.
There is no per-product override for this label. The label is global.
Per-product setting
Section titled “Per-product setting”Edit a product and open Product data → General.
Pre-order
Section titled “Pre-order”A single checkbox, stored as the product meta _preorder_enabled (yes when ticked, empty when not). Ticking it marks the product as a pre-order; combined with the global toggle being on, the product:
- stays purchasable while its stock status is out of stock (Preorder filters
woocommerce_is_purchasable,woocommerce_product_is_in_stockandwoocommerce_product_backorders_allowed), as long as it has a price, a priceless product is left non-purchasable; - shows the configured button label and the reservation stub;
- flags its cart and order lines as pre-orders.
The checkbox is rendered on the General product-data tab, so it is available for the product types that show that tab. The cart/order flag is set against whichever product or variation is added to the cart.
How the layers combine
Section titled “How the layers combine”- The global toggle decides whether the pre-order behaviour runs at all. Off means no Preorder hooks register.
- The button label is a single store-wide value with a built-in Pre-order now fallback.
- The per-product checkbox decides which products are pre-orders.
Storefront theming
Section titled “Storefront theming”The reservation stub is styled from assets/css/storefront.css and reads theme colours from CSS custom properties, each with a built-in fallback. Override them from your theme to match its palette:
.preorder-stub { --preorder-accent: #1f6feb; /* stamped ink */ --preorder-accent-strong: #1450b0; /* deeper ink */ --preorder-surface: #ffffff; /* paper */ --preorder-surface-edge: #eef1f4; /* paper edge */ --preorder-text-color: #1c2733; /* body text */ --preorder-hole-color: #e7ecf1; /* punched hole */ --preorder-hole-edge-color: #cdd6df;}The stylesheet ships a dark variant under prefers-color-scheme: dark and suppresses the punch animation under prefers-reduced-motion: reduce. Both stylesheet and script load only on a single pre-order product page.
Security
Section titled “Security”The settings screen is gated on the manage_woocommerce capability and its form is nonce-protected (check_admin_referer). The product checkbox save re-verifies WooCommerce’s woocommerce_meta_nonce defensively before writing meta. All output is escaped and all input sanitised.
Storage and uninstall
Section titled “Storage and uninstall”Preorder creates no custom database tables. It stores one option (preorder_settings) and one product meta key (_preorder_enabled). Deleting the plugin from the Plugins screen runs the uninstall routine, which removes the preorder_settings option. The per-product _preorder_enabled meta is intentionally left in place, it is product content that may be useful to other tools and is cheap to leave; remove it manually if you want it gone.