Give your customers the option to select a membership duration and offer a discount for a longer term. This is a great way to collect a larger up-front payment from members and offer an incentive to pay for membership in advance.
About the Recipe
This code will add a “Membership Duration” dropdown field to your checkout page. Once selected, the member’s expiration date and initial payment amount will be updated accordingly.
In the code recipe, there is a 20% discount when selecting a 2-year membership duration and a 25% discount for selecting a 3-year membership duration. The code recipe serves as an example for what is possible, you can alter the recipe to remove the discount or adjust the discount to suit your business.
You will need to input the Level ID that you want this code recipe to apply to. Only select membership levels that are billed on a yearly basis otherwise this will conflict with other level billing periods. Add your Membership Level ID to
'levels' => array( 8 )
This code recipe requires the Register Helper Add On to be installed and activated. If you need help altering this code to suit your needs, feel free to get in touch with one of our Support Engineers on our Member Support Forum.
The Code Recipe
Our Register Helper Add On allows you to collect additional fields at membership checkout, on the user’s profile, or for administrative view-only. For people who aren’t familiar with coding, this plugin can be a bit daunting to use. Figarts recently launched a third-party extension to simplify form building with Register Helper: Paid Memberships Pro – Form Builder.
About the Premium Plugin
Paid Memberships Pro – Form Builder allows you to create fields via a drag and drop builder. The plugin includes the option to add “checkout boxes” just like Register Helper allows you to do, all without custom code.
View the Premium Plugin
The code gist below outlines how to add search functionality for a specific user profile field/user meta field added by Register Helper or other custom WordPress user meta fields. We plan to move some of this functionality into the core plugin, but welcome feedback from early adopters.
To search on a specific meta key, enter the query as follows: field_name:field_value. For example, if you have a user meta field “gender” and want to search for the value “female”, enter gender:female or to find all members with billing addresses in the state of Pennsylvania, search for pmpro_bstate:pa.
Use this code recipe in combination with the Register Helper add on to have checkout fields that adjust membership price, either for the initial payment, recurring payments, or both.
Why would I want to do this?
There are several use-cases that need this type of option that change’s your level’s price. Some ideas, to name a few:
- An association that publishes a quarterly magazine. Allow members to optionally pay extra to receive a physical copy via mail.
- A food-box or equivalent that has a frequency or quality selection, such as daily or 3 times a week OR good, better, and best.
- A health coach who wants to add an optional “weekly call” with the client.
- An education or online learning site that allows you to select one or more additional courses in your membership.