Give existing members a lower price when they upgrade to a higher membership level, automatically, with no discount code required. This code recipe checks a member’s current level at checkout and adjusts the price for one specific upgrade path, so members who are already paying you feel rewarded for moving up instead of paying the same price as a brand new signup.

Offer Members a Discounted Rate for Upgrading to a Higher Level code recipe

Do You Need This Recipe?

This recipe fits when you want to encourage members on one level to upgrade to a specific higher level, and the discount only needs to apply to people who already hold the starting level. It is a flat, fixed discount tied to one level-to-level path, not a general “give everyone a coupon” tool.

If you want to charge members only the difference between what they already paid and the price of a new level, based on how much time is left in their billing cycle, use PMPro’s Proration Add On instead. That Add On calculates prorated credit for you. This recipe is for a flat discount you set yourself.

Best Practices and Considerations

This code only changes the price a member sees at checkout. It does not change the price shown on your Membership Levels page, and the discount only appears once the member selects the level and reaches the checkout page. Tell members about the discount somewhere before checkout (an email, a note on the levels page) so the price does not seem to change on them unexpectedly.

About the Code Recipe

This recipe uses two PMPro hooks.

The pmpro_checkout_level filter runs on the level object before checkout pricing is calculated. The code checks whether the currently logged-in member already holds a specific level with pmpro_hasMembershipLevel(), and whether they are checking out for a different, specific level. When both are true, it overwrites $level->initial_payment with the discounted amount. If the target level also bills on a recurring basis, you can uncomment a few extra lines to discount the recurring billing_amount, cycle_number, and cycle_period too, not just the first payment.

The pmpro_level_cost_text filter adds a short note to the price text everywhere PMPro displays it (checkout, confirmation, account page). The note only appears when the level was actually adjusted by the filter above, so members checking out at the regular price never see it.

The Code Recipe

PMPro checkout page showing a discounted membership price for a member upgrading from Starter to Pro, with a note that the member upgrade price was applied

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 Customize This Code Recipe

  • Set the qualifying level (line 21): Update 1 in pmpro_hasMembershipLevel( 1 ) to the ID of the level a member must currently hold to qualify for the discount.
  • Set the discounted level (line 21): Update 2 in (int) $level->id === 2 to the ID of the level this discount applies to.
  • Set the discounted price (line 24): Update 25.00 to the discounted initial payment you want to charge.
  • Discount the recurring rate (lines 30-32): If the discounted level bills on a recurring basis and you want to lower the ongoing payment too, not just the first one, uncomment $level->billing_amount, $level->cycle_number, and $level->cycle_period and set them to the terms you want.
  • Change or remove the price note (line 51): Edit the text in pmpro_adjust_price_for_members_upgrading_cost_text(), or remove the function and its add_filter() call entirely if you would rather not display any note about the adjusted price.



Was this article helpful?
YesNo

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.

Featured Image for Membership Site Development Course: The Basics