Internal server error when deleting account from dashboard
I'm a LDH user who wants to delete his account. Instead of using middleware dashboard to delete the account I first decide to cancel the subscription via the shop website. I navigate to
my_account page on the shop and cancel the subscription from there. This is not the right way of doing it. You should delete the account through the middleware which will cancel all subscription you might have active.
What happens on the middleware?
When a user uses "Delete my account" link from middleware profile page after cancelling the subscription via the web shop the middleware crashes. This is because the middleware will go through every subscription the user has and will change the subscription status to 'CANCELLED'. If a subscription was already cancelled,
Subscription class will set
next_payment_date to 1900-01-01 (on memory, not in WC) which at the time on saving will make the WC REST API fail... triggering middleware crash.
Do not set 1900-01-01 as
next_payment_date for cancelled subscriptions. Just use
None and at the time of saving use the empty string as the value for
Also, do not try to cancel subscriptions that are already on 'CANCELLED' status.