How It Works

Packages and Grouping

You probably noticed Grouping options on screenshots and might be wondering what is it for? It's an important setting taking handling flexibility to the next level.

Grouping allows you to handle an order per item, per product, per shipping class or entire order at once.

Packages

When a new order arrives and it's the time to check it against some rule's conditions, order items get splitted up into packages according to the grouping mode. Package is just one or more order items. Just like the order, with the only difference that there is only one order processed at a time, while packages may be multiple. In other words, a package is a chunk of an order.

Package term mentioned in the article is not related in any way to real packaging. It's just a term representing a set of order items.

  • When grouping is by shipping class, order gets splitted up into a number of packages, one for each shipping class in an order. Each package contains only items with a corresponding shipping class. Order splitted by shipping class
  • When it's, say, by item every single item gets packed in a separate package, producing as many packages as there are items in an order. Order splitted by item
  • Another example is all items at once grouping (this is the default value) which makes an order transformed into a single package containing all order items. Order is not splitted at all

Flow

Once order is splitted up into one or more packages they are checked against rule conditions. Package must match all rule conditions to be Captured. Not captured packages fall-through to a next rule, captured ones go to the Processing stage of the current rule.

Before being passed to calculations, captured packages are merged into a single package. So, conditions take a single package on input (an order) and give a single package on output (a merged package).

A merged package is splitted up again, but now according to the grouping mode of the Processing section. Each new package is processed separately (one by one) by calculations. This stage produces a number of Rates, one for each package.

Produced rates get summed together becoming a single rate. This rate becomes the rule result.

You don't have to always have same grouping modes for both Conditions and Processing sections. Conditions grouping and Processing grouping are not related to each other in any way. They are completely unlinked. Although in some cases you might really want to have them same for both sections, it does not make much sense to have them same in all rules.