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

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

Closed
@franmastromarino

Description

@franmastromarino

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] => ->
            )`

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions