This extension adds a new type of field in the Form Fields settings.
Standard options are available for this field, like Label, Width, Text before, Text after, etc.
Amount Expression
This is the expression that will calculate the total amount.
You can mix dynamic fields with Dynamic Shortcodes {form:field_ID}
or Elementor shortcodes [field id="field_ID"]
and static numbers grouped if needed inside brackets. Besides arithmetic operators you can use JS operators and functions.
β
If you would like, you could also insert multiple Javascript math methods, like Math.round() or similar.
Here are some examples:
{form:field_1} * 2 + 8
{form:field_1} * ({form:field_2} + {form:field_3})
NOTE: All fields used in the formula MUST be numbers (integer or float).
Select and Radio could be used if you set a specific number for each option (multiple selections will be summed together):
Red|1
Blue|2
Green|3
Use Amount in Actions
The Amount is otherwise a normal field and its result will be available in email data and other actions, calling it with its Custom ID.
{form:my_total
}[field id="my_total"]
Round Amount Field
You can round the amount field result to the desired precision.
Ternary Operator on Amount Field
You can use the JS Ternary Operator to have conditional expression. The syntax is <Condition> ? <If-True> : <If-False>
, for example:
{form:number} > 10 ? {form:number} * 2 : {form:number} * 5
β