How to Build a Player Roster with Age-Based Pricing
Register players with age-based registration fees in a single form submission.
This article requires the GP Nested Forms perk.
Buy Gravity Perks to get this perk plus 46 other premium Gravity Forms plugins!
One of our favorite things to see is when a customer combines a couple of our perks together to create a form that saves them and their users time. The following tutorial is one of those occasions. A customer wrote into Support with a question about their form and when I tested it I said to myself, “This is really clever!” That inspired me to write this tutorial so I could share what I learned.
Let’s dive in.
Overview
In this tutorial, we’re going to create a single form that performs multiple functions:
- Register multiple players on a team.
- Adjust each player’s registration fee based on the player’s age.
- Process the entire registration in a single form submission.
To accomplish this, we’re going to combine a couple of our Perks:
Try this demo to get a feel for how it works.
Steps
- Create the Players Form
- Calculate Age
- Set up Conditional Pricing
- Create the Team Form
- Calculate the Registration Total
Step 1 – Create the Players Form
Create a new form and name it “Players”. Add the following fields to the form:
- Name
- Date
- Number
- Product
Name the Date field “Date of Birth”. If you want to limit the age of the players for the team, check out GF Limit Dates.
Step 2 – Calculate Age
We’ll calculate each player’s age in the Number field using GF Date Time Calculator. Check the Enable Calculation checkbox and insert the merge tag for the “Date of Birth” field. Add the :age merge tag modifier to it to automatically calculate age.
Step 3 – Set up Conditional Pricing
With age calculation in place, we can use GF Conditional Pricing to set up pricing based on the player’s age.
Step 4 – Create the Team Form
With the Players form completed, it’s time to set up the Team form. Add a Nested Form Field to the form and select the Players form.
Step 5 – Calculate the Registration Total
Add a Product field to the form, set the Field Type to Calculation, and use the :total merge tag modifier to total up the player registration fees from the Nested Form.
Wrapping Up
With this last step completed, we now have a form to register a team with a full player roster that will automatically adjust the price based on a player’s age. It’s easy for a user to submit an entry and all the heavy lifting is handled with a handful of Perks.
Taking It Further
The Conditional Pricing in this form is dependent on the value in the Age field. If the value in this field is changed, the price changes. To prevent this, either set it as hidden or use GF Read Only.
You can set an age limit for your teams with GF Limit Dates. Set a minimum or maximum date range to prevent players that are too young or too old from joining the team.
How do you change the message “There are no entries” to “There are no players” in your example?
Hi Dottie,
You can change the message using the Entry Labels setting. Add the words “player” and “players” to the Singular and Plural settings, and the message will update on your form.