There may be an occasion when you want to offer a special price for early registrations but Gravity Forms can’t do it out of the box. Adding the following code snippet to your Theme Functions will allow you to create a timestamp with conditional arguments.
At your own risk, paste the following snippet into your theme’s functions.php:
Once the above code has been applied to your theme functions, you need to create a Gravity Form and tell it which field to populate with the timestamp.
Open any form you want to use this functionality with and follow these steps:
- Add a new Hidden field and label it “Timestamp”
- Click on the “Advanced” tab to view the field’s advanced settings.
- Check the checkbox labeled “Allow Field to be Populated Dynamically”.
- Enabling the “Allow Field to be Populated Dynamically” option will reveal the “Parameter Name” input. Add this value
The next step is to add your conditional values/actions
- Create another field that you would like to which you would like to apply the date-based conditional logic.
- Click on the “Advanced” tab to access the field’s advanced settings.
- Check the “Enable Conditional Logic” checkbox.
- Select the “Timestamp” field from the first drop down.
- Select “less than” or “greater than” from the operator drop-down depending on your intent.
- Enter the timestamp for the date this condition is based on.
How to configure the date for the timestamp
The conditional date will also need to be in the UNIX timestamp format. Use this online UNIX timestamp converter to convert the date you want to base your show/hide condition on to a timestamp. Once you have your timestamp, enter it into the last input on the condition row.