This article requires the GP Date Time Calculator perk.
Buy Gravity Perks to get this perk plus 46 other premium Gravity Forms plugins!
Offering differently priced products based on a customers age is a common sales technique. You might offer a lower membership price for children or give a discount to seniors.
In this simple tutorial, we’ll use GF Date Time Calculator to a build a form that will conditionally calculate a price per unit based on a customer’s age.
Step 1 – Create a Date of Birth Field
Add a Date field to the form, name it “Date of Birth”, and set your desired date format.
Step 2 – Create an Age Field
Add a Number field, enable calculation, and insert the merge tag for the Date of Birth field with the
:age merge tag
modifier to automatically calculate age.
Step 3 – Create Product Fields for Each Age Group
With the age calculation taken care of, create separate Product Fields for each age group and use conditional logic to show them based on the customer’s age.
Create a Product field for the age group and set the price.
Enable Conditional Logic for the field and set your parameters based on age.
Repeat this for every age group.
And here’s how that behaves on the front end.
Taking It Further
While using separate Product fields and conditional logic provides a simple solution to offer multiple pricing levels, a more elegant option is to use GF Conditional Pricing to automatically adjust the pricing levels of a single Product field. This provides two benefits:
- Your form uses a single Product field instead of 3 separate product fields. This keeps things cleaner on the back end, especially if you plan on exporting your form data or integrating it with another system.
GF Conditional Pricing offers more robust pricing options, such as offering quantity-based discounts on top of the age-based discount.
That’s all for now!
Do you have any questions about how to set this up? We’d love to hear them. Leave a comment below.
Did this resource help you do something awesome with Gravity Forms?
Then you'll absolutely love Gravity Perks; a suite of 46+ essential add-ons for Gravity Forms with support you can count on.
Leave a Reply