3. Order Calculations (Totals)
fmOrderCalculations - Order Calculations Form
This section will help you to change shipping method and cost, provide or change the discount and see how it affects order totals.
The most interesting option of this section is Calculation Settings. When you click on Settings Button you'll see the Order Calculations window. Here you can configure how order values are calculated.
Formula is an arithmetical expression. It can contain two types of elements - operand and operator.
There are three hardcoded operands:
sum_price - sum of "Price" * "Quantity" for all products in current order
sum_final_price - sum of "Final Price" * "Quantity" for all products in current order
average_products_tax - average tax % for all products in current order. Value 0.15 = 15% tax
Other operands can be inserted by clicking right mouse button on formula field.
Allowed operators: + add; - subtract; / divide; * multiply. Also you can use round brackets ( )
More information about expressions here.
Formula examples:
(subtotal - version #1 ): sum_final_price
(subtotal - version #2 ): sum_final_price - [ot_discount, 0.0]
(tax - version #1 ): (sum_final_price - [ot_discount, 0.0] - [ot_coupon, 0.0]) * average_products_tax
(tax - version #2 ): (sum_final_price * average_products_tax) + sum_final_price - ot_discount - ot_coupon
(total): ot_subtotal + [ot_tax, 0.0] + [ot_shipping, 0.0] - [ot_coupon, 0.0] - [ot_discount, 0.0]
Value specified in square brackets represents default value for an operand if specified operand name not found. As for example, order total (formula above) calculated as subtotal + tax + shipping... but actually not every order have tax and shipping fields. If fields specified in formula are not found, default value will be set.
Formula operand [ot_tax, 0.0] has default value of 0.0, [ot_tax, 15.5] means default value of 15.5 and so on.