How It Works

Rule Tree and Child Rules

Organizing rules in the tree is possible due to Child rules calculation.

Child rules is just a regular calculation like Weight rate or Percentage fee, and thus resides the same flow. You can even have multiple Child rules calculations in a single rule. An example of parent rule calculations

It works on per-package basis like any other calculation. That means it processes all child rules for each coming package, as many times as there are packages in the queue.

The calculation iterates over children passing current package to each as if it was an order coming from a customer. Child rules produce rates which are aggregated by the calculation according to the appropriate switch. It can be, e.g. sum to sum child rates, min or max to return lowest or highest rate, and a few others. There is also all option which prevents child rates from being aggregated at all.

Technically, even root rules which you create are children of an invisible super-root rule.

There is a number of cases when nested rules can be useful, e.g.
  • extracting common conditions and calculations from two or more rules to a parent;
  • processing each parent package with multiple child rules;
  • using parent rules as folders to keep rules organized well.