=== Australcode Back In Stock for WooCommerce ===
Contributors: australcode
Tags: back in stock, waitlist, stock notification, restock alert, out of stock
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 8.2
Stable tag: 1.6.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Back in stock alerts for WooCommerce — waitlist with double opt-in & GDPR-friendly consent, background sending that scales, core features free.

== Description ==

**Australcode Back In Stock** turns out-of-stock products into recovered sales. It is privacy-first (double opt-in and explicit consent built in), sends through Action Scheduler so big waiting lists never time out, and keeps every core feature free (Pro adds restock coupons, recovered-revenue tracking, SMS/WhatsApp alerts, email-marketing sync and webhooks). When a product is sold out, a "Notify me when available" form appears on the product page. Customers leave their email, and the moment you restock they get an automatic email with a link straight to it.

No more lost sales because a customer couldn't be bothered to check back.

= How it works =

1. A product runs out of stock.
2. A subscribe form appears on the product page (simple and variable products).
3. Customers enter their email — optionally confirming it first (double opt-in).
4. You restock the product.
5. Everyone on the waiting list gets an automatic email with a link to buy it.
6. Customers can unsubscribe with one click from any email.

= Free features =

* "Notify me when available" form on out-of-stock products (simple and variable).
* Shortcode and Gutenberg block to place the form anywhere — works with any page builder; add `mode="product"` for popups and modals (Elementor, Divi).
* Automatic restock email with the product's photo, price and a direct link — a card built to win the sale back, not just notify.
* Per-product subscriber list in the admin, with KPIs, a "Top demand" panel, status filters and email search.
* Optional double opt-in (email confirmation before subscribing).
* Optional consent checkbox (privacy-law friendly).
* One-click unsubscribe from every email.
* Reliable background sending via Action Scheduler — works for products with hundreds of subscribers without timing out.
* Cache and CDN proof — the form fetches a fresh security token at submit time, so it keeps working behind full-page edge caches like Cloudflare and Kinsta.
* Developer hooks — PHP actions and filters (`acbis_after_subscribe`, `acbis_email_args`) plus an `acbis:subscribed` JavaScript event, to wire signups into your CRM, analytics or email tool.
* Customizable button label and email subject/heading text.

= Pro features =

* **Restock coupons** — include a unique, single-use discount in each restock email. It is applied automatically at checkout (no copy-pasting), is restricted to the product and the customer's email, and expires after the window you choose, so the urgency is real.
* **Recovered-revenue tracking** — a dashboard that attributes paid orders back to your restock coupons, so you see exactly how many sales and how much revenue the waiting list brings back.
* **SMS & WhatsApp alerts** — reach customers on their phone too, through your own Twilio account. Opt-in only: the customer adds their number and ticks a separate consent box, and the alert goes out by SMS and/or WhatsApp alongside the email.
* **Email-marketing sync** — every subscriber is automatically added to your Klaviyo list or Mailchimp audience (bring your own API key), so you can build flows and segments around real back-in-stock demand.
* **Webhooks & demand alerts** — fire a signed JSON webhook on every signup and restock (wire it to Zapier, Make, n8n or your own endpoint), and get a Slack or Discord ping the moment a product passes a demand threshold you set. Turn the waiting list into an inventory signal for your team.
* Export the subscriber list to CSV (per product, with status and dates).

[Get Pro &rarr;](https://back-in-stock.australcode.io)

= Privacy =

The plugin sends restock emails through your own site (`wp_mail` / your SMTP). The free plugin never sends your subscribers' data to any third-party service: emails are stored in your own database, and the IP used for anti-abuse rate limiting is stored hashed, never in clear text. Two optional integrations are off by default: the Pro **SMS/WhatsApp** feature sends the phone number you collect — with the customer's separate consent — to **Twilio** to deliver the message, and **Freemius** handles licensing and updates. Both are described under "External services" below.

== Installation ==

1. Upload the plugin to `/wp-content/plugins/`, or install it from the Plugins screen.
2. Activate it. WooCommerce must be installed and active.
3. Go to **Back in Stock → Settings** to review the options (double opt-in, button label, email texts).
4. That's it — the subscribe form shows automatically on any out-of-stock product.

== Frequently Asked Questions ==

= Does it work with variable products? =

Yes. For variable products the form appears when the customer selects an out-of-stock variation, and notifies only the people waiting for that specific variation.

= Will it send hundreds of emails at once and time out? =

No. Sending runs in the background through Action Scheduler (bundled with WooCommerce), in batches, so it scales to large waiting lists.

= Do customers need an account? =

No. They only leave an email. Confirmation and unsubscribe work through secure tokenized links, no login required.

= Does it send my customers' data anywhere? =

By default, no. Restock emails are sent from your site's own email (wp_mail / your SMTP) and your subscribers' data stays in your database. Two optional integrations can send data, both off by default: the Pro SMS/WhatsApp feature sends a customer's phone number (with their consent) to Twilio to deliver the message, and Freemius handles license validation and updates if you opt in. See "External services".

= Does the form work with page caching? =

Yes. The form is rendered with the product page and submissions go through AJAX, so cached pages keep working. If a cached page is very old (most caches expire within hours), the security token can expire — the customer simply gets a "please refresh and try again" message instead of a silent failure.

= What makes this plugin a good fit? =

It is built for real stores: reliable background sending, double opt-in and explicit consent built in, and a clean admin list to see exactly who is waiting for what. The Pro version adds restock coupons that recover sales automatically, a recovered-revenue dashboard, and one-click CSV export of your subscriber list.

== External services ==

= Freemius (account, licensing & secure checkout) =

Australcode Back In Stock uses Freemius as its billing and licensing platform (Freemius is the Merchant of Record for Pro purchases). Connecting to Freemius is **optional**: on activation you can click **"Skip"** and the plugin stays fully functional without ever contacting Freemius.

* If you **opt in** (free or Pro), the plugin sends your **admin email**, **site URL** and basic **environment data** (WordPress, PHP and plugin versions) to the Freemius API (host `api.freemius.com`, path `/v1/`) to create your account and check for updates.
* If you **activate a Pro license**, the plugin sends your **license key** and **site domain** to Freemius to validate the license and enforce the per-plan site limit. The license is re-validated periodically.
* Purchases and license management happen on Freemius-hosted pages (hosts `freemius.com`, `users.freemius.com`).

No data is sent to Freemius if you skip the opt-in and do not enter a license key.

* Terms of Service: https://freemius.com/terms/
* Privacy Policy: https://freemius.com/privacy/

= Twilio (SMS & WhatsApp delivery — Pro, optional) =

The Pro "SMS & WhatsApp alerts" feature is **off by default** and only works if you enable it and enter your own Twilio credentials. When a subscriber has given phone consent and a product is restocked, the plugin sends the subscriber's **phone number** and the **message text** to the Twilio API (host `api.twilio.com`, path `/2010-04-01/`) so Twilio delivers the SMS/WhatsApp. Your Twilio Account SID and Auth Token are stored encrypted in your database and used only to authenticate these requests. No data is sent to Twilio unless you enable a channel and configure credentials.

* Terms of Service: https://www.twilio.com/legal/tos
* Privacy Policy: https://www.twilio.com/legal/privacy

= Klaviyo & Mailchimp (email-marketing sync — Pro, optional) =

The Pro "Email marketing sync" feature is **off by default** and only works if you enable a provider and enter your own API key. When a customer subscribes to a back-in-stock alert, the plugin sends their **email address** to the provider you enabled — Klaviyo (host `a.klaviyo.com`) or Mailchimp (host `<dc>.api.mailchimp.com`) — to add them to the list/audience you choose. Your API key is stored encrypted in your database and used only to authenticate these requests. No data is sent unless you enable a provider and configure it.

* Klaviyo — Terms: https://www.klaviyo.com/legal/website-terms-of-use · Privacy: https://www.klaviyo.com/legal/privacy-policy
* Mailchimp — Terms: https://mailchimp.com/legal/terms/ · Privacy: https://mailchimp.com/legal/privacy/

= Webhooks & Slack/Discord demand alerts (Pro, optional) =

The Pro "Webhooks & demand alerts" feature is **off by default** and only sends data to URLs **you** configure — it is not tied to any service we operate. When you set a webhook URL, the plugin POSTs a small JSON payload (event type, customer email, product ID and name, timestamp) to that URL on each signup and restock, signed with an HMAC-SHA256 `X-Acbis-Signature` header so your endpoint can verify it. When you set a Slack or Discord incoming-webhook URL and a demand threshold, it POSTs a short text message to that URL when a product reaches the threshold. The destinations are entirely yours (for example Zapier, Make, n8n, Slack or Discord); review the terms and privacy policy of whichever service you point them at. No data is sent unless you enter a URL.

== Screenshots ==

1. The "Notify me when available" form on an out-of-stock product page.
2. The subscriber list in the admin, with KPIs and filters (the CSV export shown is the Pro add-on).
3. The settings screen with inline guidance for every option.
4. The automatic restock email customers receive — one tap from inbox to checkout.

== Changelog ==

= 1.6.0 =
* Added (Pro): Webhooks & demand alerts. Fire a signed JSON webhook on every signup and restock (wire it to Zapier, Make, n8n or any endpoint), and get a Slack/Discord ping when a product passes a demand threshold you set. The free plugin is unchanged.

= 1.5.0 =
* Added (Pro): Email-marketing sync. Every back-in-stock subscriber is automatically added to your Klaviyo list or Mailchimp audience (bring your own API key), so you can build flows and segments around real demand. The free plugin is unchanged.

= 1.4.0 =
* Added (Pro): SMS & WhatsApp restock alerts via Twilio. Customers opt in with their phone number and a separate consent checkbox; the alert then goes out by SMS and/or WhatsApp alongside the email. Bring your own Twilio account. The free plugin is unchanged.

= 1.3.0 =
* Added (Pro): Restock coupons — each restock email can carry a unique, single-use discount that is applied automatically at checkout and expires after the window you choose, turning waitlist demand into recovered sales. The free plugin is unchanged.
* Added (Pro): Recovered-revenue dashboard — attributes paid orders back to your restock coupons, so you see how many sales and how much revenue the waiting list brings back.

= 1.2.2 =
* Improved: the admin menu is tidier — the separate "Family" page is now folded into a single "Upgrade" screen that shows your license status, what Pro unlocks, and the rest of the Australcode family.

= 1.2.1 =
* Improved: restock and confirmation emails now show a preview line in the inbox (preheader) and lead with the product name, so they read well before being opened.
* Improved: the email call-to-action now renders as a solid button in Outlook desktop, not just a text link.
* Improved: the subscriber list filter bar wraps neatly on narrow screens instead of crowding the edge.

= 1.2.0 =
* Improved: restock emails now show the product image and price, so customers can go from inbox to checkout in one tap.
* Improved: the subscriber list is now fully usable on phones and tablets — tap any row to reveal its product, status and date.
* Improved: a clearer first-run screen with a next step, and a refined admin menu icon that matches the Australcode family.

= 1.1.0 =
* Added: the "Notify me" form now works reliably inside popups and page builders (Elementor, Divi) — a new shortcode mode `[acbis_back_in_stock_form mode="product"]` plus an automatic product-level fallback when the form is placed away from the product page.
* Added: developer hooks to connect your own tools — `acbis_after_subscribe`, `acbis_form_html` and `acbis_email_args` actions/filters, the `acbis_should_load_assets` filter, and a JavaScript `acbis:subscribed` event (for analytics, CRM or email-marketing integrations). See docs/hooks.md.
* Fixed: on stores with full-page (edge) caching, the form could silently stop working once a cached page got old. It now fetches a fresh security token at submit time, so it keeps working behind Cloudflare, Kinsta and similar caches.
* Fixed: customers who subscribed at the product level on a variable product are now notified when any variation comes back in stock.
* Improved: the form now sizes consistently across themes, including themes that change the root font size.
* Improved: after subscribing, the form collapses into a clean confirmation.
* Improved: a new "Top demand" panel in the admin highlights the products with the most customers waiting — your restock priority.

= 1.0.0 =
* Initial public release.
* "Notify me when available" form on out-of-stock products (simple and variable) — automatic, plus shortcode and Gutenberg block for page builders.
* Automatic restock email with a direct link to the product, sent in the background via Action Scheduler.
* Per-product subscriber list with KPIs, status filters and email search.
* Optional double opt-in and explicit-consent checkbox.
* One-click unsubscribe from every email.
* Pro: export the subscriber list to CSV.

== Upgrade Notice ==

= 1.6.0 =
New Pro tools: signed webhooks for Zapier/Make/n8n and Slack/Discord demand alerts. The free plugin is unchanged. No action required after updating.

= 1.5.0 =
New Pro integration: automatic subscriber sync to Klaviyo and Mailchimp. The free plugin is unchanged. No action required after updating.

= 1.4.0 =
New Pro channel: SMS & WhatsApp restock alerts through Twilio (opt-in, with customer consent). The free plugin is unchanged. No action required after updating.

= 1.3.0 =
New Pro tools to recover sales: restock coupons applied automatically at checkout, plus a recovered-revenue dashboard. The free plugin is unchanged. No action required after updating.

= 1.2.2 =
Tidier admin menu: the separate "Family" page is now part of a single "Upgrade" screen. No action required after updating.

= 1.2.1 =
Polish for the restock email (inbox preview line, product-first heading, reliable Outlook button) and a small mobile fix for the subscriber list. No action required after updating.

= 1.2.0 =
Restock emails now include the product image and price, and the subscriber list works better on mobile. No action required after updating.

= 1.1.0 =
Reliability + integration update: fixes the form on cached storefronts, adds developer hooks, and improves popup/page-builder support. No action required after updating.

= 1.0.0 =
First public release of Australcode Back In Stock for WooCommerce.
