Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The cancelled date must occur after the last payment date. #667

Open
franmastromarino opened this issue Sep 2, 2024 · 5 comments
Open

Comments

@franmastromarino
Copy link

franmastromarino commented Sep 2, 2024

Note

When an attempt is made to cancel a subscription, an exception may be raised with a message like:

Subscription #12345: The cancelled date must occur after the last payment date.

In some cases these are handled gracefully, but it seems there may be cases where we lack the protection of a try/catch block ... probably we should address those. Original report follows.

Describe the bug
When attempting to cancel a subscription, the system throws an error with the message: Subscription #254461: The cancelled date must occur after the last payment date. This issue prevents the subscription from being cancelled through the WooCommerce Subscriptions plugin.

To Reproduce
Go to the WooCommerce Subscriptions page in the WordPress admin panel.
Attempt to cancel a subscription (e.g., Subscription #254461).
Observe the error message that appears: The cancelled date must occur after the last payment date.
Expected behavior
The subscription should be cancelled without any errors as long as the cancellation date is set correctly.

Actual behavior
The system throws an error stating that the cancellation date must occur after the last payment date, even when this condition is met. This prevents the cancellation from being processed.

Product impact
Does this issue affect WooCommerce Subscriptions? Yes
Additional context
WooCommerce Subscriptions plugin version: 6.6.0
WordPress version: 6.6
System status report: Available upon request

`(
[message:protected] => Subscription #254461: The cancelled date must occur after the last payment date.
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => /home/1253731.cloudwaysapps.com/gqeuensvmq/public_html/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php
[line:protected] => 2581
[trace:Exception:private] => Array
(
[0] => Array
(
[file] => /home/1253731.cloudwaysapps.com/gqeuensvmq/public_html/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php
[line] => 1358
[function] => validate_date_updates
[class] => WC_Subscription
[type] => ->
)

        [1] => Array
            (
                [file] => /home/1253731.cloudwaysapps.com/gqeuensvmq/public_html/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php
                [line] => 538
                [function] => update_dates
                [class] => WC_Subscription
                [type] => ->
            )`
@franmastromarino franmastromarino added the type: bug The issue is a confirmed bug. label Sep 2, 2024
@barryhughes
Copy link
Member

Thanks for the report, @franmastromarino.

This error is definitely possible but generally shouldn't happen, and I find that I am unable to replicate it (unless I take special steps to contrive it).

Is there any other context we should know about, and can you or were you able to replicate this when only running WooCommerce Subscriptions alongside WooCommerce, and without any other plugins (except perhaps for a payment gateway)?

@barryhughes barryhughes added the needs feedback The issue/PR needs a response from any of the parties involved in the issue. label Jan 28, 2025
@franmastromarino
Copy link
Author

Hello @barryhughes,

I'm unable to intentionally reproduce this issue, but it continues to occur.
I believe it may be related to this plugin: Paddle for WooCommerce.

I've reached out to their support team regarding this issue, but they haven't been able to resolve it.

Let me know if you have any insights.

@franmastromarino
Copy link
Author

This is the order notes record:

Unable to change subscription status to “cancelled”. Exception: Subscription #261184: The cancelled date must occur after the last payment date.

November 12, 2024 at 1:18 pm [Delete note]

Order [#298717] created to record renewal.

November 11, 2024 at 9:52 pm [Delete note]

Subscription cancelled by the subscriber from their account page.

October 4, 2024 at 10:46 am [Delete note]

Status changed from Active to Pending Cancellation.

October 4, 2024 at 10:46 am [Delete note]

Subscription activated by paddle webhook.

November 12, 2023 at 1:18 pm [Delete note]

Status changed from Pending to Active.

November 12, 2023 at 1:18 pm [Delete note]

Status changed from Pending to Active.

November 12, 2023 at 1:18 pm [Delete note]

Payment status marked complete.

November 12, 2023 at 1:18 pm [Delete note]

Subscription created on Paddle.

November 12, 2023 at 1:18 pm [Delete note]

@barryhughes
Copy link
Member

I believe it may be related to this plugin: Paddle for WooCommerce.

OK ... and, in case there's anything further you can share, is there any more information about that (did you find that deactivating it seems to solve the problem, or do you see something in their code that is a pretty strong hint)? Unfortunately, it doesn't seem to be openly available, so we can't see the code or do any testing around it ourselves.

@barryhughes
Copy link
Member

@franmastromarino: just checking back in! Did you get any further in your conversation with the Paddle team?

Note to our future selves: regardless of the situation with Paddle, we should probably locate instances where this exception can be raised but is not caught, and add a try/catch structure to ensure elegant handling everywhere.

@barryhughes barryhughes added priority: medium and removed needs feedback The issue/PR needs a response from any of the parties involved in the issue. labels Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants