Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

Allow the Cancelled Subscription email to be dispatched twice #787

Merged
merged 4 commits into from
Feb 26, 2025

Conversation

barryhughes
Copy link
Member

We offer merchants email-based notifications when a subscription is cancelled. When enabled, it will be dispatched when a subscription is set to either pending-cancel or cancelled, but not both.

In other words, if a subscription is initially set to pending-cancel (typically, this is the result of the customer self-serving), then the merchant will receive an email. When it then finally ends (when the status is updated to cancelled), the merchant will not receive the same cancellation email a second time.

However, as identified in the linked issue, this is not always desirable and, for some merchants, it may be useful to receive the email twice.

Fixes #771

Description

There are two separate but related changes bundled up in this PR. The first and probably the most important is a change to support optionally sending the Cancelled Subscription email twice:

New setting for the Cancelled Subscription email

Secondly, the Cancelled Subscription email itself has received a small tweak, just to help differentiate between the two different cancellation states. When a subscription is pending cancellation, we say as much and indicate when it will finally end:

Revised text for pending cancellation emails

How to test this PR

When testing, you will require something like Email Log in order to review the emails that are dispatched.

  1. Visit WooCommerce ‣ Settings ‣ Emails and look for the Cancelled Subscription email. Click to manage the settings.
    • Verify that, first time you try this, the new Always Send checkbox is disabled.
    • Please also ensure the email is enabled.
  2. As a customer, purchase a subscription and then visit the My Account ‣ Subscription area. Locate the subscription and cancel it (this sets the subscription to pending-cancel).
    • The cancellation email should have been dispatched.
    • You should see the new wording, as in the above screenshot: A subscription belonging to [name] is pending cancellation, and will end on [date].
  3. As the admin, locate the same subscription in the admin environment and click to Cancel Now. The cancellation email should not be sent a second time.
  4. Still acting as the admin user/merchant, find another active subscription and cancel it. The cancellation email should be dispatched for this other subscription.
  5. Acting as the customer for one of the fully cancelled subscriptions, go ahead and resubscribe ... then cancel again. The cancellation email should be dispatched (this is to ensure we haven't introduced a regression for Cancelled Subscription Emails are not Sending After Reactivation #658).
  6. Now return to the Cancelled Subscription settings. Enable Always Send and save.
  7. Repeat step 2 (results should be the same).
  8. Repeat step 3, but this time the email should be sent a second time.

Product impact

Thoughts and open questions

  • You may also wish to perform testing in which you take advantage of the woocommerce_subscription_use_pending_cancel filter hook (ie, to always skip the pending-cancel status and go straight to cancelled).
  • How do we feel about the changes to the email text—too subtle? Or perhaps not needed?

@barryhughes barryhughes requested review from a team and leonardola and removed request for a team February 19, 2025 03:50
Copy link
Contributor

@leonardola leonardola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With Always Send disabled:

Verify that, first time you try this, the new Always Send checkbox is disabled.

The cancellation email should have been dispatched.

You should see the new wording, as in the above screenshot: A subscription belonging to [name] is pending cancellation, and will end on [date].

As the admin, locate the same subscription in the admin environment and click to Cancel Now. The cancellation email should not be sent a second time.

Still acting as the admin user/merchant, find another active subscription and cancel it. The cancellation email should be dispatched for this other subscription.

Acting as the customer for one of the fully cancelled subscriptions, go ahead and resubscribe ... then cancel again. The cancellation email should be dispatched (this is to ensure we haven't introduced a regression for #658).

With Always Send enabled:

Now return to the Cancelled Subscription settings. Enable Always Send and save.
The cancellation email should have been dispatched.

You should see the new wording, as in the above screenshot: A subscription belonging to [name] is pending cancellation, and will end on [date].

Copy link
Contributor

@leonardola leonardola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@barryhughes barryhughes merged commit a536cbd into trunk Feb 26, 2025
9 checks passed
@barryhughes barryhughes deleted the fix/771-cancelled-subscription-emails branch February 26, 2025 17:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Email type "Expired Subscription" is not being sent
2 participants