Skip to content

snaptortoise/gravity-forms-minmax

Repository files navigation

Gravity Forms MIN/MAX Calculations

Adds MIN and MAX functions for Gravity Forms number field calculations.

https://wordpress.org/plugins/gf-minmax-calculation/

Description

This WordPress plugin adds MIN() and MAX() functions for Gravity Forms number fields calculations. It can be used to determine the highest or lowest value from any number of passed arguments, including merge tags.

Examples

This will return the smaller of the four fields (inserted as merge tags) and proceed to divide it by 2:

MIN({Field:1}, {Field:2}, {Field:3}, {Field:4}) / 2

This will return the larger of two fields and proceed to multiply by 4:

MAX({Field:1}, {Field:2}) * 4

This will return either the value of a field (if above zero) or zero:

MAX({Field:1}, 0)

This will return either the value of a field (if below zero) or zero:

MIN({Field:1}, 0)

You can include calculations within the arguments themselves, for example

MIN({Field:1} * 2, {Field:2} / 2)

Installation

From the WordPress Admin Area

  1. Download the plugin zip file from https://wordpress.org/plugins/gf-minmax-calculation/
  2. Log in to your WordPress admin area and navigate to the Plugins page
  3. Click Add New, then click Upload Plugin
  4. Click Choose File, then locate and select the plugin zip file
  5. Click Install Now

Using FTP

  1. Upload the entire gravityforms-minmax folder to the /wp-content/plugins/ directory.
  2. Activate the plugin through the 'Plugins' menu in WordPress.

Thanks

Thanks to @michaeldozark for his Gravity Forms exponents plugin which served as a good example of extending the built-in Gravity Forms calculation function.