Set a Level to Expire Based on Remaining Time in Term

This code recipe allows you to specify how far into a term you are and set your level to expire based on the time remaining. This was originally created for a site related to pregnancies, but it can be adapted for various uses.

For example, a member with a 9-month total term can specify that they are 2 months in. Then, the expiration date would be set for 7 months from now.

Note that if you are using Paid Memberships Pro V2.9+, you should create a User Field called ‘terms’ instead of using the Register Helper Add On.

This content requires a premium membership plan.