Closed nealbgit closed 1 month ago
I haven't been able to replicate this issue @nealbgit. I'm not sure if there's more to this issue.
For some background, when you reactivate a pending cancelled subscription we restore what was the original end date and next payment date which is the current "end" date.
So, when you cancel a subscription we store the current end date in meta so we can restore it later if we need to. The subscription's end date becomes the current next payment date.
When you reactivate a pending-cancelled subscription we reverse that - the subscription's end date is the value we stored in the meta and the next payment date is the current end date.
Given the error you're seeing, you'd have to have a subscription with an end date earlier than the next payment date.
Can you share anything about this subscription? eg like the product billing frequency and length settings.
I think I can probably replicate by following these steps:
It will attempt to set the end date to be in 3 months from now and the next payment to be 1 year from now. I can't edit pending-cancelled dates so I don't know how that would have happened.
Closing this due to inactivity and an inability to replicate. As I mentioned in my last comment, the only way I could see this happening is if you set the end date of a pending-cancelled subscription programmatically and the date you set it to was an invalid date once the subscription was reactivated.
Describe the bug
When reactivating a subscription that is pending cancellation, a php error occurs. The error that occurs is: Fatal error: uncaught exception: Subscription #5330796: The end date must occur after the next payment date. in /code/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wc-subscription.php
To Reproduce
Expected behavior
Apparently, when cancelling a subscription, the Next Payment date is cleared, but the end date remains.
Actual behavior
A subscription should be allowed to be reactivated when it is pending cancellation.
Product impact
Additional context
-->