In the core Paid Memberships Pro plugin, members that renew a fixed-term membership level early will automatically have the expiration date extended by one additional term.
For example, a member whose annual plan is set to expire in two weeks can renew today, and their new expiration date will be set for 54 weeks from the checkout date.
This scenario doesn’t require any custom code. PMPro handles fixed-term membership renewals of the same level automatically, adding the remaining time on the current membership to the new term.
For this post, we share a way to offer this same logic for membership level changes. The code recipe below demonstrates how you can extend a member’s current level duration when they upgrade to a new level.
For example, a member on a “Bronze” plan with two months left can upgrade to a “Gold” annual plan, and their new expiration date will be 14 months from the checkout date.
Keep reading to get that code recipe and learn more about membership renewals with Paid Memberships Pro.
Code Recipe: Apply Renewal Extension Logic to Level Changes
This code recipe allows members to extend their membership expiration date when they change their membership level, ensuring they don’t lose any remaining time on their current membership. Remember, you only need this code if you want to allow extensions on level changes. PMPro already handles extensions on same level renewals.
The recipe works by calculating the number of days left on the member’s existing membership and then adding those days to the expiration date of the new membership level they are checking out for.
Here’s a breakdown of what this code recipe is doing step-by-step:
- First, check that the renewal is eligible for extension logic: The code first verifies that the new membership level has an expiration date, that the member is currently active with an expiring membership, and that they are not simply renewing the same level (since core PMPro already handles this case).
- Then, calculate the remaining time on their active level: If the conditions are met, this code then calculates the number of days remaining on the current membership.
- Finally, update the level object to extend the expiration date: The remaining days are then added to the expiration period of the new level. The code adjusts the expiration number and period to reflect this additional time, converting everything to days to be perfectly accurate.
This code recipe uses the pmpro_checkout_level
filter, a filter that can modify the membership level details during the checkout process.
Screenshots: Before and After
Adding the Recipe to Your Website
You can add this recipe to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository. Read this companion article for step-by-step directions on either method.
How to Offer Shorter-Term Membership Extensions
In this guide, we’ve assumed that the member wants to renew or upgrade from one fixed-term membership to another for the same term, e.g. 1 year.
Some sites also ask about letting members purchase a shorter extension, for example a 30 or 60 day renewal membership.
To achieve this, you can create new “Extension” membership levels with shorter term expiration periods. Here’s how to create your extension levels:
- Create new membership levels with the same access as your full term levels.
- Set a shorter expiration date on the extension levels you create (e.g., 30 days, 60 days).
- Set the price on these extensions based on your annual plan, potentially with a slight increase for the shorter term. For example, if your 1 year membership is $120, you could sell a 60 day membership for $25 or $30.
These levels will show up on your membership site’s Membership Levels page. You can hide them from that page using a custom pricing page or the Advanced Levels Page Add On. If you do hide the levels, consider sending a link to your “hidden” extension levels in the renewal reminder or adding a link to purchase an extension on the membership account page.
When members purchase one of these “Extension” levels, their current membership will be extended by the corresponding number of days.
Understanding Fixed-Term vs. Recurring Memberships
In this guide, we shared a lot of detail about extended membership expiration dates. This extension logic applies only to fixed-term memberships, not recurring subscriptions.
- Fixed-Term Memberships: If a member with a 1-year membership expiring in 14 days renews or purchases an extension, their new expiration date will include those extra 14 days.
- Recurring Subscriptions: For members switching to a recurring subscription (automatic renewals), their renewal date will begin immediately, and no extension of the previous term occurs. Consider using the Proration Add On to support members with active subscriptions who want to change levels without losing prepaid value on their current membership.
Consider Which Approach Fits Your Membership Model
To decide which method fits your membership model, consider these scenarios:
- Fixed-Term Renewals: Ideal for members who prefer to manage their memberships on an annual or set-term basis.
- Level Upgrades: Use the custom code to allow members to retain unused time when upgrading.
- Short-Term Extensions: Offer additional flexibility by selling 30 or 60-day extensions.
Be prepared to explain these options to members, especially if they ask why their membership was extended (or not) after a renewal or level change.
Free Course: Membership Site Development—The Basics
Develop a deeper understanding of membership site development in this beginner-level course. Learn how to make your site work better, save yourself time and money, and improve your site's performance.