=== Essential OptiCart ===
Contributors: rahatsheikhleon
Tags: woocommerce, abandoned cart, loyalty points, rewards, membership
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 8.1
Stable tag: 1.0.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
WC requires at least: 7.0
WC tested up to: 10.8

Admin-driven, automation-first WooCommerce plugin: abandoned cart recovery emails plus a full loyalty points & membership tier system.

== Description ==

Essential OptiCart bundles two independent, individually-togglable features for WooCommerce stores. Configure once; everything else runs automatically via WP-Cron and WooCommerce hooks.

**Abandoned Cart Recovery (ACR)**

* Real-time checkout email capture (guests on blur, logged-in users on add-to-cart), gated by a GDPR consent checkbox.
* Configurable 1–5 step reminder sequence — each step with its own delay, subject, body, and optional single-use coupon.
* Hourly cron worker that schedules sequences, sends due emails (with bounded retry on failure), and expires finished carts.
* One-click signed cart-restore links, open/click tracking, and one-click unsubscribe (theme-independent confirmation page).
* Category/product exclusions and a minimum cart value.
* Analytics: abandoned, sent, open/click rate, recovered, recovery rate, recovered revenue, unsubscribes.

**Loyalty & Membership System (LMS)**

* Three earning modes (flat, per amount spent, price-tier rules) plus per-product/category multipliers and time-boxed double-point events.
* Points wallet + full ledger (earn / redeem / expire / manual), with a customer-facing **My Points** tab in My Account.
* Membership tiers (Bronze/Silver/Gold/Platinum by default) by lifetime points or current balance.
* Redemption Mode A (milestone coupon, emailed + shown in account) and Mode B (flexible checkout slider with min/max caps).
* Points expiry by inactivity with advance warning emails.
* Manual single adjustments (mandatory note) and CSV bulk adjustments.
* Analytics: issued, redeemed, outstanding liability, coupons, tier distribution, top earners.

Email delivery uses your site's configured `wp_mail()`. Essential OptiCart automatically connects with any SMTP plugin (such as WP Mail SMTP, FluentSMTP, or Post SMTP) — no extra configuration needed. Just install and activate your preferred SMTP plugin and Essential OptiCart will use it automatically. Both features are off by default and fully translatable (WPML/Polylang-aware email templates).

== Installation ==

1. Upload the `essential-opticart` folder to `/wp-content/plugins/`, or install via the Plugins screen.
2. Activate **Essential OptiCart**. On activation it creates its custom tables, writes default settings, and schedules its cron jobs.
3. Configure each feature under **Essential OptiCart → ACR Settings** and **Essential OptiCart → LMS Settings**. Both features are off by default.

Requires WooCommerce 7.0+ and PHP 8.1+.

== Frequently Asked Questions ==

= Do guests earn loyalty points? =
No. Only registered users earn and redeem points. Guests can still receive abandoned-cart recovery emails (with consent).

= Does it send email itself? =
No. Essential OptiCart uses your site's `wp_mail()` system. It automatically works with any SMTP plugin (WP Mail SMTP, FluentSMTP, Post SMTP, etc.) — no configuration needed on Essential OptiCart's side. Simply install your preferred SMTP plugin and activate it.

= Is my data removed on uninstall? =
By default all data is preserved. Enable *Danger Zone → Delete all Essential OptiCart data on uninstall* (on either settings page) to drop tables, options, and usermeta on deletion. Essential OptiCart also integrates with WordPress's Export/Erase Personal Data tools.

= Will points be lost if a payment fails? =
No. Points are deducted on order completion / payment, never when a coupon is merely applied, so failed payments never consume points.

= The "Apply Points" slider doesn't show at checkout — why? =
The Mode B redemption widget currently renders on the **classic (shortcode) checkout**. If your store uses the newer block-based Checkout, set the Checkout page to the `[woocommerce_checkout]` shortcode so the widget appears. A native block-checkout integration is planned.

== Development ==

This plugin ships its human-readable sources alongside the compiled output:

* `src/` — source for the WooCommerce Checkout blocks compiled to `build/blocks-checkout/`.
* `admin-src/` — React/TypeScript source for the admin app compiled to `build/admin/`.
* `assets/scss/` *(in the repository)* — SCSS sources compiled to `assets/css/`.

Full source, build tooling, and history are public at:
https://github.com/RahatSheikhLeon/essential-opticart

Build from source:

`npm install`
`npm run build:blocks`   (wp-scripts → build/blocks-checkout/)
`npm run build:admin`    (Vite → build/admin/)
`npm run build`          (SCSS → assets/css/)

== Changelog ==

= 1.0.0 =
* Initial release.
* Abandoned Cart Recovery: capture, multi-step sequences, coupons, cart restore, open/click tracking, unsubscribe, analytics.
* Loyalty & Membership System: earning modes, tiers, redemption Mode A/B, expiry, manual + CSV adjustments, My Points account tab, analytics.
* GDPR: personal-data exporter/eraser integration and anonymization on account deletion.

== Upgrade Notice ==

= 1.0.0 =
Initial public release.
