Skip to content

Confirmation of Plan Cancellation/Reactivation#3

Open
YvesCesar wants to merge 3 commits into
mainfrom
feat/subscription-cancel-confirmation
Open

Confirmation of Plan Cancellation/Reactivation#3
YvesCesar wants to merge 3 commits into
mainfrom
feat/subscription-cancel-confirmation

Conversation

@YvesCesar

@YvesCesar YvesCesar commented Jul 22, 2026

Copy link
Copy Markdown

Summary

Customers could cancel or reactivate a subscription with a single click on the My Subscription page, WooCommerce Subscriptions applies the status change immediately, making accidental changes too easy.

This PR adds a server-side confirmation step before the change is applied.

How it works

  • A hook on wp_loaded (priority 99) intercepts the status change request one priority before WCS_User_Change_Status_Handler (priority 100) and redirects back to the subscription page.
  • A WooCommerce notice asks for confirmation ("Yes, cancel subscription" / "No, keep subscription"). Only the confirmed link passes through to the original handler, so all of its nonce and permission validation remains intact.
  • Works without JavaScript.

The statuses that require confirmation are defined in a single map (libresign_get_subscription_confirmation_strings), currently cancelled and active (reactivation). New statuses can be added with one entry.

Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
@YvesCesar
YvesCesar requested a review from vitormattos July 22, 2026 21:46
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
@YvesCesar YvesCesar changed the title Feat/subscription cancel confirmation Confirmation of Plan Cancellation/Reactivation Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant