=== Doolol Cart Recovery ===
Contributors: arminkbool
Author: Armin Kazemi
Tags: abandoned cart, cart recovery, woocommerce, web push, email marketing
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.1.0
Desired plugin slug/permalink: doolol-cart-recovery
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Recover abandoned WooCommerce carts with email + web push. Smart discounts, no dark patterns, GDPR-ready. Works for guests too.

== Description ==

**7 out of 10 shoppers leave your store without buying.** Doolol Cart Recovery quietly
brings them back.

Doolol Cart Recovery tracks every WooCommerce cart — guest or logged-in — detects
abandonment, and fires a respectful 3-step recovery sequence across **email**
and **web push notifications**. A rule-based Smart Discount Engine issues
coupons only when they are actually likely to close the sale, never as a
blanket give-away that trains customers to abandon on purpose.

No third-party SaaS accounts. No monthly fees for the core features. No dark
patterns. Just a lightweight plugin that works on your own infrastructure and
puts recovered revenue back in your pocket.

---

= Why store owners choose Doolol Cart Recovery =

* **Email + Web Push in one plugin** — Reach customers through two high-intent
  channels without paying for two separate SaaS subscriptions.
* **Guest recovery** — Captures and recovers guest carts the moment a shopper
  types their email at checkout. No account required.
* **Smart Discount Engine** — Issues percentage-off coupons only to first-time
  customers and high-value carts, preserving margin everywhere else.
* **No CDN, no tracking, no phone-home** — All assets are self-hosted. The plugin
  contains zero analytics code and makes no external network requests of its own.
* **GDPR-ready out of the box** — Built-in 90-day data retention, one-click
  unsubscribe, and full WordPress privacy-tool integration.
* **Frequency cap + quiet hours** — Respects your customers with a weekly send
  limit and a configurable no-send window (default 10 pm – 8 am).

**Web Push channel** *(Pro)*

Doolol Cart Recovery generates its own VAPID keys and delivers browser push
notifications directly from your server — no third-party push service, no
SaaS middleman, no per-subscriber fees. Consent is collected via a minimal,
non-intrusive banner that appears only on WooCommerce-context pages.

**Smart Discount Engine** *(Pro)*

Rule-based coupon generation:
1. VIP customers (configurable allowlist) are excluded — they should not be trained to abandon.
2. First-time customers receive a larger discount (default 10 %).
3. High-value carts receive a smaller discount (default 5 %).
4. All other carts receive no discount — a recovery email alone is often enough.

Coupons are restricted to the customer's email address, expire in 48 hours, and are
single-use, so a leaked code does minimal damage.

**Recovery sequence**

Steps 1 and 2 are available on the Free plan. Steps 2 and 3, web push, custom
delays, quiet hours, the frequency cap, and the Smart Discount Engine require **Pro**.

| Step | Delay     | Channel                   |
|------|-----------|---------------------------|
| 1    | 1 hour    | Email                     |
| 2    | 24 hours  | Email + Web Push          |
| 3    | 72 hours  | Email (with coupon) + Web Push |

== External services ==

This plugin sends Web Push notifications through the push messaging service of each visitor's own web browser. When a visitor opts in to push notifications, their browser provides a unique push endpoint URL hosted by their browser vendor's push service:

* Google Chrome / Android → Firebase Cloud Messaging (FCM), operated by Google LLC
* Mozilla Firefox → Mozilla Push Service, operated by Mozilla
* Apple Safari → Apple Push Notification service, operated by Apple Inc.

Data sent: When a recovery push notification is dispatched, the plugin sends the encrypted notification payload (cart reminder title, body text, and recovery URL) to the push endpoint URL that the visitor's browser provided. No personal data is sent to these services beyond what is required to deliver the notification to the subscribed browser.

When: Only when a visitor has explicitly opted in to push notifications, and only when their cart is abandoned and a recovery push is scheduled.

These push services are operated by the respective browser vendors:
* Google FCM: Terms https://firebase.google.com/terms — Privacy https://firebase.google.com/support/privacy
* Mozilla Push: Privacy https://www.mozilla.org/privacy/
* Apple Push: Terms https://www.apple.com/legal/internet-services/ — Privacy https://www.apple.com/legal/privacy/

== Installation ==

= From the WordPress admin =

1. Go to **Plugins → Add New**.
2. Search for **Doolol Cart Recovery**.
3. Click **Install Now**, then **Activate**.
4. Visit **Doolol Cart Recovery → Settings** to review the defaults — the plugin works
   out of the box, but you may want to set a custom from-name and from-address for
   recovery emails.

= Manual installation =

1. Unzip `cartwhisper.zip` and upload the `cartwhisper` folder to
   `/wp-content/plugins/`.
2. Activate the plugin through **Plugins → Installed Plugins**.
3. Visit **Doolol Cart Recovery → Settings**.

= First-time setup =

* Four database tables are created automatically (`wp_cartwhisper_carts`,
  `wp_cartwhisper_events`, `wp_cartwhisper_messages`,
  `wp_cartwhisper_subscribers`).
* VAPID keys for Web Push are generated on activation.
* Visit **Doolol Cart Recovery → Dashboard** to confirm everything is running.
* For best email deliverability, pair Doolol Cart Recovery with an SMTP plugin such
  as WP Mail SMTP or FluentSMTP.

== Frequently Asked Questions ==

= Does Doolol Cart Recovery work for guest shoppers? =

Yes — and this is one of Doolol Cart Recovery's strengths. Guest shoppers are tracked
by a first-party cookie the moment they land on any WooCommerce page. Their
email address is captured when they start filling in the checkout form, so
recovery emails can be sent even if they never complete the purchase.

= Does Web Push work without a third-party service? =

Yes. Doolol Cart Recovery uses the VAPID protocol with keys Doolol Cart Recovery
generates and stores on your own server. Push notifications are delivered
directly from WordPress to the browser via the browser vendor's push relay.
No SaaS push service, no per-subscriber pricing.

= Will this slow down my store? =

Doolol Cart Recovery is lightweight by design. It hooks into standard WooCommerce cart
events (which fire whether or not any recovery plugin is installed) and writes
to its own tables rather than post meta. The abandonment-detection cron and
sequence-dispatch cron run in the background and do not block page loads.

= How are recovery emails sent? =

Through WordPress's built-in `wp_mail()`. This means Doolol Cart Recovery works with
any transactional email plugin or service you already have configured —
Mailgun, SendGrid, Amazon SES, or a dedicated SMTP relay.

For production use we recommend pairing Doolol Cart Recovery with an SMTP plugin to
ensure reliable delivery and avoid the spam folder.

= Can I customise the email templates? =

The template files live in `wp-content/plugins/cartwhisper/execution/channels/templates/`.
Copy the file you want to change into `wp-content/themes/your-theme/cartwhisper/templates/`
and WordPress will use your copy instead (child-theme-safe). A visual template
editor is planned for a future Pro release.

= Does this work with WooCommerce High-Performance Order Storage (HPOS)? =

Yes. Doolol Cart Recovery explicitly declares compatibility with WooCommerce's
HPOS feature. It does not query the `wp_posts` table for order data.

= Is this plugin GDPR-compliant? =

Doolol Cart Recovery was built with GDPR in mind from day one:

* Personal data (email, name, cart contents) is deleted automatically after
  90 days of inactivity.
* Every recovery email contains a one-click unsubscribe link; opting out
  blacklists the address permanently.
* The plugin registers a personal-data exporter and eraser with WordPress's
  built-in privacy tools (Tools → Export Personal Data / Erase Personal Data).
* No data ever leaves your server — there are no analytics calls, no telemetry,
  and no third-party SaaS dependencies.

Unsubscribed / erased addresses are stored only as hashed values and are
preserved until you decide to clean them up. If you want Doolol Cart Recovery to remove
all its tables and options on deletion, tick the **Delete all Doolol Cart Recovery data
on uninstall** checkbox on the Settings page.

= Does Doolol Cart Recovery track analytics or phone home? =

No. Doolol Cart Recovery contains no analytics code, no telemetry, and no phone-home
requests of any kind. All data stays on your server. Freemius is included for
optional licensing of the Pro plan; it is only activated if you choose to
connect your site through the upgrade flow.

= Why are some carts not getting emails? =

Check the following:

1. **Cart value** — The default minimum cart value is $5. Carts below this are
   silently skipped (configurable in Settings).
2. **Unsubscribe** — The customer may have previously unsubscribed or been
   erased via the privacy tools.
3. **Quiet hours** — The sequence-dispatch cron honours the quiet-hours window
   and will defer sends until the window ends.
4. **Frequency cap** — If the customer has received 3 or more sequence steps in
   the past 7 days, further sends are paused.
5. **WP-Cron** — On high-traffic sites, WordPress pseudo-cron can be unreliable.
   For production, set up a real server cron job or use WP-Crontrol to verify
   cron events are firing.

= Does the plugin support real cron jobs? =

Yes — the plugin registers its own cron intervals and works with any cron
driver. For best reliability on production sites, disable WordPress pseudo-cron
by adding `define( 'DISABLE_WP_CRON', true );` to `wp-config.php`, then add a
real server cron job (`*/5 * * * * curl https://yourstore.com/wp-cron.php`)
or install the **Action Scheduler** library (bundled with WooCommerce) — it
provides a robust job queue that Doolol Cart Recovery will support in a future release.

= What versions of WooCommerce and WordPress are supported? =

Doolol Cart Recovery requires WordPress 6.0+ and WooCommerce 8.0+. It is tested up
to WordPress 6.7 and WooCommerce 9.5. PHP 7.4 is the minimum; PHP 8.2 is
recommended.

== Screenshots ==

1. Dashboard — Recovery stats: abandoned carts, recovered carts, recovery rate, revenue.
2. Settings screen — Configure abandonment threshold, sequence delays, and all options.

== Changelog ==

= 1.1.0 =
* Added Freemius SDK integration for Pro licensing.
* Added Web Push channel (Pro): VAPID key generation, service worker, consent prompt, PushSender.
* Added Smart Discount Engine (Pro): rule-based coupon generation for step 3.
* Added sequence scheduler with configurable delays, quiet hours, and frequency cap.
* Added admin dashboard with recovery-rate trend chart (pure Canvas, no CDN).
* Added Settings page with 5 sections: General, Email, Web Push, Sequences, Advanced.
* Added system-status panel and send-test-email feature to Settings.
* Added GDPR compliance: 90-day data retention cron, WP privacy exporter/eraser, unsubscribe blacklist.

= 1.0.0 =
* First public release of Doolol Cart Recovery.
