Skip to content

Instantly share code, notes, and snippets.

@landbryo
Last active September 9, 2023 20:18
Show Gist options
  • Save landbryo/8abcc14579b9db4f24c404394f3f907e to your computer and use it in GitHub Desktop.
Save landbryo/8abcc14579b9db4f24c404394f3f907e to your computer and use it in GitHub Desktop.
Example Gravity Form Complex Calculation

Complex calculations in Gravity Forms may not work in the order that you'd expect. In this scenario, instead of subtracting the total value of the calculations from the value of field 15, we have to force the order of operation by subtracting it at the end, which creates a negative number. To return the number to positive, we multiply the total value by -1.

(
    ( {:15} * ( {:3} * 0.01 ) ) + 
    ( {:15} * ( {:16} * 0.01 ) ) + 
    ( {:15} * ( {:17} * 0.01 ) ) + 
    ( {:15} * ( {:7} * 0.01 ) ) - 
    ( {:15} ) 
) * -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment