=== WT Waitlist ===
Contributors: webmastersteam
Donate link: https://webmasters.team/
Tags: woocommerce, waitlist, back-in-stock, stock-notifier, notifications
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 8.0
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Lightweight waitlist for WooCommerce — automatic email notifications when an out-of-stock product (or variation) is back in stock.

== Description ==

**WT Waitlist** is a "back in stock" waitlist for WooCommerce without bloat. Customers leave their email on an out-of-stock product page, and when the stock returns — the plugin sends a notification in the background through Action Scheduler.

Built by the [webmasters.team](https://webmasters.team) team. Open-source code, no external APIs, all data stored locally in the WordPress database.

= Key features =

* **Signup form replaces Add to cart** for out-of-stock products, with variation support (per size/color).
* **Custom database tables** (`{prefix}_waitlist_subscriptions`) — we do not clutter `wp_postmeta`, the plugin scales to tens of thousands of subscriptions.
* **Action Scheduler queue** (bundled with WooCommerce): batch of 50 emails per tick, automatic retries, retry log visible in `WooCommerce → Status → Scheduled Actions`.
* **5 min throttle** per product — prevents duplicate sends when multiple hooks fire (e.g. quantity change followed by status change).
* **One-click unsubscribe** via a link in the email (SHA-256 token), no confirmation or login required.
* **GDPR-ready**: consent logging (anonymized IP, timestamp, user agent), integration with WordPress Privacy Tools (export and erasure of data per email).
* **CSV export** of subscribers from the admin panel (streamed, no timeouts on large lists).
* **Anti-spam**: honeypot plus rate limiter per IP (10 submissions per hour).
* **Theme compatibility**: classic themes (Storefront, Twenty Twenty-One/Two/Three) plus block themes (Twenty Twenty-Four/Five) — the form attaches through a hook for classic templates and through a `render_block` filter for FSE.
* **Zero external dependencies**: apart from WooCommerce, requires only plain PHP 8.0+.

= Shortcode fallback =

`[wt_waitlist product_id="123"]` — use this if your custom product template does not fire the standard hooks.

= What WT Waitlist does NOT do (by design) =

* No SMS, no Mailchimp/MailerLite integrations in the free version.
* No double opt-in (minimal flow — leave email, get notification).
* No WYSIWYG editor for email templates (HTML template lives in the plugin file, override with the `wt_waitlist/notification_context` filter).

These features are planned for the Pro edition. The free edition covers 100% of the core waitlist flow.

== Installation ==

1. Install and activate WooCommerce (required).
2. Install **WT Waitlist** via WP Admin → Plugins → Add new, or manually over FTP (folder `wt-waitlist` in `wp-content/plugins/`).
3. Activate the plugin.
4. Open the **WT Waitlist** menu in the admin panel and configure data retention plus the administrator notification email address.

On first activation the plugin creates its database tables and schedules a daily job that purges old subscriptions.

== Frequently Asked Questions ==

= How does the form appear on the product page? =

Automatically — the plugin hooks into the standard WooCommerce action (`woocommerce_single_product_summary`) for classic themes and into the `render_block` filter for block themes (FSE). The form is shown only when the product is out of stock.

= What if my theme or template does not fire WooCommerce hooks? =

Use the shortcode `[wt_waitlist product_id="123"]` — it works everywhere, from page builders to custom single product templates.

= How many emails are sent at once? =

Action Scheduler processes batches of 50 subscribers per tick. For a product with 1000 subscribers we queue 20 batches, each processed asynchronously, without blocking the PHP request.

= Do emails go through my WP Mail configuration? =

Yes. We use `wp_mail()` — if you have WP Mail SMTP, SendGrid, Amazon SES etc. configured, the mail travels through them. The plugin does not hardcode any provider.

= What happens to the data after uninstalling the plugin? =

The `uninstall.php` file drops the tables and deletes the options. Clean. If you deactivate without deleting, the data stays — you can reactivate without losing subscriptions.

= GDPR compliance? =

The plugin stores anonymized IPs (last octet zeroed), consent timestamp and user agent. It integrates with WordPress Privacy Tools — a customer can request data export or deletion through the standard WordPress flow.

== Screenshots ==

1. Waitlist form on a WooCommerce out-of-stock product page.
2. Subscriber management screen in the admin with filters, statuses and CSV export.
3. Notification email delivered when the product is back in stock.

== Changelog ==

= 1.0.1 =
* Fix: replaced inline `<style>` block in the unsubscribe page with `wp_register_style()` + `wp_print_styles()` (WP guideline compliance).

= 1.0.0 =
First public release.

* Waitlist form on product pages (simple + variable), classic and block theme support.
* Custom database tables (`{prefix}_waitlist_subscriptions`, `{prefix}_waitlist_email_log`).
* Stock-status change detection through WooCommerce hooks.
* Notification queue through Action Scheduler with 5 min throttle and batches of 50.
* One-click unsubscribe with SHA-256 token.
* Admin panel: subscriber list with filters and CSV export.
* Product-edit widget showing waitlist count.
* Integration with WordPress Privacy Tools (export + eraser).
* Shortcode `[wt_waitlist]` as fallback.
* Honeypot plus rate limiter (10/hour per IP).
* Automatic purge of old subscriptions (configurable retention).

== Upgrade Notice ==

= 1.0.1 =
Compliance fix for the unsubscribe page styling. No behavior changes.

= 1.0.0 =
First public release. Requires WooCommerce ≥ 7.0 and PHP 8.0+.
