=== Renew Forge – UK Subscription Rules for WooCommerce ===
Contributors: avakodeforge
Tags: woocommerce, subscriptions, cancellation, compliance, uk
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 8.2
Stable tag: 0.1.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Get WooCommerce Subscriptions ready for the UK subscription rules: compliance check, one-click cancel, confirmation email and evidence journal.

== Description ==

The UK Digital Markets, Competition and Consumers Act 2024 brings in new rules for subscriptions: customers must be able to leave online as easily as they joined, get a written confirmation when they cancel, and see the key terms before they subscribe. The government expects the rules to apply from spring 2027; the regulations that fill in the details are not published yet.

**Renew Forge** helps a WooCommerce Subscriptions store get ready now, and keeps a record of what happened when a customer cancels. Wording and behaviour are configurable, so you can match them to the final regulations and to your own terms. It is a tool, not legal advice, and it does not guarantee compliance on its own.

= What it does =

* **Compliance check** — 14 items about your store, each with its status, what we found, what to do and the provision it is about.
* **One-click cancel button** in My account → Subscriptions and on each subscription page. One press cancels; there is no "are you sure?" page.
* **Confirmation email** with the date the subscription ends, sent as soon as the customer cancels.
* **Evidence journal** of every cancellation: who, when, from which screen and whether the confirmation email was sent. IP address and browser are stored only as keyed hashes.
* **Alerts to the shop** when a cancellation is refused or its confirmation email cannot be sent.
* **CSV export** of the journal, exactly as stored.
* **Subscription summary** on subscription product pages: price, billing period, renewal, free trial and how to cancel.
* **Subscription cancellation block** and shortcode for account pages built with blocks or a page builder.

Renewal reminders, cooling-off refunds and a pre-contract acknowledgement at checkout are part of Renew Forge Pro, a separate plugin.

= How cancelling works =

The customer presses **Cancel subscription**. The subscription moves to "Pending cancellation" at once: the customer keeps access until the end of the period already paid for and no further payment is taken. The page confirms it and shows the date access ends, and the confirmation email goes out. A second press changes nothing.

Cancellations made another way — with the WooCommerce Subscriptions Cancel link, by a shop manager in wp-admin, by a payment gateway or through the REST API — are confirmed and journaled too, once per cancellation. By default the WooCommerce Subscriptions Cancel link is replaced by the Renew Forge button, so customers have a single way to cancel; you can keep it in the settings.

= If something goes wrong =

If WooCommerce Subscriptions refuses a cancellation, or the confirmation email cannot be sent, the shop is told straight away: an email to the shop, a note on the subscription and a notice in the dashboard until someone marks it handled. A confirmation email that failed is tried again three more times within 24 hours. A fault in the journal never stops a cancellation.

= The journal is evidence =

Records are only ever added. Nothing in the plugin edits or deletes a record, and the CSV export writes each record as it was stored. A recorded compliance check shows what your store looked like on a given day.

= Your data stays on your site =

The plugin makes no external requests and loads nothing from third-party servers. It schedules nothing on activation; its only background task is the retry of a confirmation email that failed to send. It adds suggested wording about the journal to the privacy policy guide under Settings → Privacy.

== Hooks ==

= rnwf_subscription_cancelled =

Fires after a customer cancels with the Renew Forge button.

`do_action( 'rnwf_subscription_cancelled', $subscription_id, $outcome, $email_sent )`

= rnwf_compliance_checks =

Filters the list of compliance check items (objects implementing `RenewForge\Compliance\Check`).

= rnwf_reminder_provider =

Lets a plugin that sends renewal reminders describe them in one line; the compliance check then shows the reminders item as passed.

== External services ==

This plugin does not connect to any external service. It makes no HTTP requests and sends no data anywhere.

== Installation ==

1. Install and activate WooCommerce and WooCommerce Subscriptions.
2. Install this plugin from Plugins → Add New, or upload the folder to `/wp-content/plugins/`, and activate it.
3. Go to **Renew Forge → Compliance check** and work through the items.
4. Adjust the button, the summary box and the cancellation email in **Renew Forge → Settings** and under WooCommerce → Settings → Emails.

== Frequently Asked Questions ==

= Is this legal advice? Does it make my store compliant? =

No. It helps with the parts a plugin can do: an online cancel button, a written confirmation, a summary of the key terms and a record of what happened. The rules are expected from spring 2027 and the regulations are not published yet, so wording and timings are settings you can change.

= Does it work without WooCommerce Subscriptions? =

The compliance check, the journal and the settings open, and the check tells you what is missing. Nothing touches a subscription until WooCommerce Subscriptions is active.

= What exactly goes into the journal? =

The event type, the subscription and customer numbers, the date and time, which button was used, the status before and after, the date access ends, whether the email was sent and which version of its wording, and keyed hashes of the IP address and browser. A refused cancellation is recorded with the reason. No card details, no raw IP address.

= My theme is a block theme. Where do the button and the summary appear? =

The cancel button appears in the WooCommerce Subscriptions account screens whatever the theme. On a page built with blocks, add the Subscription cancellation block. The subscription summary appears in front of the Add to Cart block of subscription products, and is also available as the Subscription summary block.

= What happens to my data if I delete the plugin? =

By default the journal and settings stay, because the journal is your evidence. Tick "Delete the journal and the Renew Forge settings when the plugin is deleted" in Renew Forge → Settings first if you want them gone. Only users who may delete plugins can change that setting.

== Screenshots ==

1. Compliance check: each item with its status, what we found and what to do.
2. The one-click cancel button on a subscription in My account.
3. The journal: filter by type, subscription, customer and dates; export to CSV exactly as stored.
4. The subscription summary on a product page.
5. Settings: the cancel button, the summary on product pages, and what happens to your data on deletion.

== Changelog ==

= 0.1.2 =
* Fixed: items that other plugins add to the Compliance check through the rnwf_compliance_checks filter were left off the Compliance screen when those plugins load after Renew Forge. The list is now read when the screen is shown.
* Developers: the subscriptions gateway says whether a subscription synchronised to a payment day had a free or reduced first period (concessionaryFirstPeriod()); each paid order carries whether it was an early renewal, and the whole order's total and refunds — including a refund entered as an amount without order lines —, so its refundable amount is never more than the order has left.

= 0.1.1 =
* Changed: a store whose subscriptions can have a minimum term (set by an add-on) keeps it when a customer presses the cancel button: the request is recorded, the subscription ends at the end of the term and the payments until then remain due. The customer is told the date on screen and by email, My account shows it instead of a second button, and the journal records it (new record type "Cancellation requested: ends at the end of the minimum term"). Without such an add-on the button works as before.
* Developers: the cart's subscription terms include what each renewal will take (recurring delivery, fees and tax) and the end date of a fixed-length subscription, taken from WooCommerce Subscriptions' recurring carts, which are built first when WooCommerce has not calculated them yet.

= 0.1.0 =
* First release: compliance check, one-click cancel button with confirmation email, evidence journal with CSV export, subscription summary on product pages.

== Upgrade Notice ==

= 0.1.2 =
Compliance items added by other plugins are listed on the Compliance screen; paid orders carry early renewals and refunds without order lines.

= 0.1.1 =
Cancellations under a minimum term end at the end of the term; the cart's subscription terms carry what each renewal takes.

= 0.1.0 =
First release.
