How to Set Up Age Based Pricing

This article requires the GP Date Time Calculator perk.

Buy Gravity Perks to get this perk plus 47 other premium Gravity Forms plugins!

View Plugin Buy Gravity Perks

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.

Steps

  1. Create a Date of Birth Field
  2. Create an Age Field
  3. Create Product Fields For Each Age Group

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.

Date of Birth

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.

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.

  1. Create a Product field for the age group and set the price.

    Senior Product
  2. Enable Conditional Logic for the field and set your parameters based on age.

    Age Conditional Logic
  3. Repeat this for every age group.

And here’s how that behaves on the front end.

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:

  1. 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.
  2. GF Conditional Pricing offers more robust pricing options, such as offering quantity-based discounts on top of the age-based discount.

    Age and Quantity Combined

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.

Grab a bundle of free Gravity Forms plugins

Enter your email and receive our most popular free plugins and snippets, plus access to hundreds of others.

This field is for validation purposes and should be left unchanged.