Search code examples
phpfunctiongravity-forms-plugin

Gravity Forms Price based on financial quarter of year


I'm trying to build a membership form with Gravity Forms, but I've just been informed that the membership price goes down each quarter of the year, starting from April, by £22.

So in April, the price is £90. In July the price becomes £68 etc.

Is there a way that this can be done?

I'm thinking a Gravity Forms Hook must allow calculations on the price somewhere, I just can't find where.


Solution

  • You can accomplish this with multiple product fields, a little custom code, and Gravity Forms' conditional logic

    Here's the custom code you'll need which uses the gform_field_value filter

    add_filter("gform_field_value_timestamp", "gwiz_populate_timestamp"); 
    function gwiz_populate_timestamp( $value ){
        return time();
    }
    

    Once you add this code to you functions.php file, you would need to then create different product fields and show/hide the product fields conditionally depending on the date.

    Using this method, each product could have the adjusted price required for that date range.

    More info on this approach can be found at http://gravitywiz.com/use-gravity-forms-conditional-logic-with-dates/

    A No Code Alternative

    Another approach would be to use GP Conditional Logic Dates and GP Conditional Pricing Plugins. You can then use a single product field and dynamically change the price based on the date, all from you Form Admin.