# 4. Order Calculations

fmOrderCalculations - Order Calculations Form

This section is for 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 'Settings' button you'll see the 'Order Calculations' window. Here you can configure how order values will be 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 the current order
• sum_final_price - sum of "Final Price" * "Quantity" for all the 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 ( )

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 was not found. As for example order total (formula above) calculated as subtotal + tax + shipping... but it should be taken into consideration that actually not every order have tax and shipping fields. If fields specified in formula are not found it will take default value.

Formula operand [ot_tax, 0.0] has default value of 0.0, [ot_tax, 15.5] and means default value of 15.5 and so on.

Zen Cart Order Calculation