Cancel at EOT then reactivate subscription

I created some custom code that reactivates a users account so it does not cancel at EOT and it works except it seems that S2 has some functionality somewhere that cancels the account again.

Does S2member do some sort of check that cancels the account in this situation? Maybe some data stored in the database somewhere that I need to alter when I reactivate the account?

I’m using Stripe.

Thanks

Hi Corey.

Hmm… After the EOT behavior, s2 empties the EOT field, so the behavior should not happen again. Maybe something is setting an EOT time again? If there’s an EOT time set and its an expired date (older than now), the behavior will be applied.

When you try your hack, check afterwards if the user’s EOT field is now empty or not.

Well, I’m assuming that when you say “reactivate a user’s account”, it’s because it was demoted by the EOT behavior. Or did you mean something else?

Thanks. Yes, you are correct. This is a user who was demoted and their account is going to be downgraded to a free plan at the end of their term.

I removed the value in the EOT field in the database. Even after doing that, something is forcing the “at_period_end” to be “true” in stripe. When I refresh the database, the EOT field is still empty too.

Quick update

I figured out a workaround but still not exactly sure what is causing the original issue. The issue happens when I refresh the page for some reason. I could not figure out what was causing it so I just send the user to a new page when its done instead.

1 Like

Thanks for the updates and extra info.

I see, if on refresh… Did you deactivate other plugins while troubleshooting? Do you have anything in your must-use plugins directory that may be doing it?

I’m glad you found a way around the odd behavior. :slight_smile: