=== Retention Core: Subscription Cancel Saver for WooCommerce ===
Contributors: matthew1287, freemius
Tags: woocommerce, subscriptions, retention, cancel, survey
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.2
Stable tag: 1.0.7
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Intercept subscription cancellations with a lightweight exit survey. Free collects reasons and tallies; Pro (separate package) adds save offers.

== Description ==

Retention Core asks subscribers *why* they are cancelling before WooCommerce Subscriptions completes the cancel on **My Account → View Subscription**.

This WordPress.org package is the **free** experience:

* Lightweight cancel survey (vanilla JS — no jQuery on the modal)
* Editable survey title, intro, and button labels
* Stable cancel reason IDs stored on the subscription + order note
* Cancel reason visible on the subscription edit screen in wp-admin
* Optional email to the site admin when a reason is submitted
* Reason tallies, top-reason insight, and CSV export under **WooCommerce → Settings → Retention Core**
* Editable cancel reasons
* Assets load only on the View Subscription screen (no shop/checkout bloat)

Pro save flows (win-back offers, status banner, offer email) ship in a **separate premium package** via Freemius — they are not included in this free download.

Merchant help: [user guide](https://msdk.com.au/retention-core/retention-core-user-guide/)

== Premium Features ==

A separate premium package (not in this WordPress.org ZIP) adds:

* Per-reason save offers (Step 2 modal): recurring coupon, pause, or skip next order
* Gates on each offer: minimum orders, minimum months, and stop after months
* Apply recurring subscription coupons (`recurring_percent` / `recurring_fee`)
* Pause next payment by N billing periods, or skip one billing interval (subscription stays active)
* Save results on Reports, plus a Dashboard widget for revenue recovered
* Status banner on View Subscription while the offer is active
* Customer email when an offer is accepted
* Marketing → Win-back offers CPT

Upgrade: [msdk.com.au/retention-core](https://msdk.com.au/retention-core/)

== Installation ==

1. Install and activate WooCommerce and WooCommerce Subscriptions.
2. Upload this plugin to `/wp-content/plugins/` or install via Plugins → Add New.
3. Activate **Retention Core**.
4. Open **WooCommerce → Settings → Retention Core** to view reports, customize the Survey, and edit Reasons.
5. (Optional) Buy Pro and install the premium package / activate your license under **WooCommerce → Retention Core → Account**.

== Frequently Asked Questions ==

= Does it require WooCommerce Subscriptions? =

Yes. The plugin will not boot without WooCommerce Subscriptions.

= Does it slow down the shop or checkout? =

No. Scripts and styles enqueue only on My Account → View Subscription.

= Does it create custom database tables? =

No. Settings live in `wp_options`; cancel data is subscription meta and order notes.

= Will cancel still work if JavaScript fails? =

The native Subscriptions cancel URL remains available; the survey may be skipped for that click.

= Does this plugin phone home? =

Licensing and optional usage opt-in are powered by Freemius. See the Freemius privacy policy and your site’s Privacy Policy suggested text after activation. You can skip opt-in and still use Free features. Optional merchant cancel-survey emails go to your WordPress admin address only.

= How do I upgrade to Pro? =

Buy Pro at [msdk.com.au/retention-core](https://msdk.com.au/retention-core/), then activate your license under **WooCommerce → Retention Core → Account** (Freemius delivers the premium package).

= What coupon types work with Pro offers? =

(Pro package only.) WooCommerce Subscriptions recurring coupons: Recurring Product % Discount and Recurring Product Discount.

== Screenshots ==

1. Cancel survey on View Subscription.
2. Win-back offer shown before the cancel goes through (Pro).
3. Status banner after the subscriber accepts (Pro).
4. Cancel reason reports.
5. Win-back offers list (Pro).
6. Offer setup: reason, type, and recurring coupon (Pro).

== Changelog ==

= 1.0.7 =
* Pro: Qualifying rules live on each win-back offer (minimum orders, minimum months, stop after months). The shop-wide Offer logic screen is removed.

= 1.0.6 =
* Pro: Skip next order. The subscription stays active and the next payment moves forward by one billing interval, so that cycle is not charged and does not ship.
* Pro: Offer logic. Hide discount coupons until a subscription has enough related orders, and prefer a VIP offer after a tenure threshold.
* Pro: WordPress Dashboard widget for revenue recovered, cancellations intercepted, and the top survey reason.
* Help page under WooCommerce → Settings → Retention Core describing skip, pause, tenure rules, and the dashboard.

= 1.0.5 =
* Pro: Save results on Reports. Offers shown, accepted, and declined, next renewal kept, cash collected after a save, discount given, and billing deferred for pauses.

= 1.0.4 =
* Fix: Reasons could not be saved. An empty template row blocked the settings form.

= 1.0.3 =
* Plugin Check: reports CSV no longer uses direct filesystem calls, and the empty languages folder no longer ships a hidden file.

= 1.0.2 =
* Tested with WordPress 7.1 and WooCommerce 11.1.

= 1.0.1 =
* Free: editable survey copy; merchant email on cancel reason; cancel reason on subscription admin; Reports top-reason insight.

= 1.0.0 =
* Survey idempotency per billing cycle; Free Reports section with bars + CSV export.
* WordPress.org / Freemius packaging: premium-only strip, prefixed classes (`MSDK_RC_*`), privacy policy text.
* Pro (premium package): replace existing subscription coupons with plain-language notice; silent skip invalid coupons.
* Pro: pause advances by billing periods with end-date guard; limited-coupon banner hides at remaining 0.

= 0.1.0 =
* Initial release candidate: cancel survey, tallies, Pro coupon/pause offers, status banner, offer-accepted email.

== Upgrade Notice ==

= 1.0.7 =
Pro: set who qualifies on each win-back offer. VIP-only offers keep their month gate. Coupon offers are no longer hidden by a shop-wide order count.

= 1.0.6 =
Pro: skip the next order, tenure rules for discounts, and a dashboard widget for revenue recovered.

= 1.0.5 =
Pro: see whether save offers kept the next renewal, and the cash collected after a save.

= 1.0.4 =
Fix saving cancel reasons in Settings.

= 1.0.3 =
Plugin Check cleanup ahead of the WordPress.org submission.

= 1.0.2 =
Tested with WordPress 7.1 and WooCommerce 11.1.

= 1.0.1 =
Free thickening: survey branding, admin reason panel, merchant notify email, Reports insight.

= 1.0.0 =
Hardening release: Reports, safer packaging for WordPress.org, cycle-scoped tallies.

= 0.1.0 =
First public-facing build. Requires WooCommerce Subscriptions.
