# Totaling of Shipping Rates

## Overview

With ProductMatrix you need to think about what happens when there are:

1. Multiple items of the same SKU in the cart
2. Multiple items of the same shipping group in the cart
3. Multiple items with different shipping groups in the cart

For example you may have set up your rules so that Beds cost \$50 and Drawers cost \$20. What happens when both beds are drawers are in the cart?  And what happens when 2 beds are in the cart?

This is where the totaling(aka totalling!) logic comes in, and it’s a very important part of getting ProductMatrix to work effectively.

## Setting the Totaling Rule

You can set the totaling in Magento Admin under `System->Configuration->Shipping Methods->ProductMatrix->Totaling Algorithm`.

## Common Totaling Algorithm Options

These two totaling algorithms are used by around 99% of our clients. If in doubt we recommend using one of these.

### Sum of Group Totals (aka Per Package)

The sum of the matching rate of each shipping group for every matching delivery type.

Using the Bed/Drawers example with the Sum of Group totaling the total shipping price would be the price of the Bed group + the price of the Drawers group. No matter how many beds or drawers it would always be \$50+\$20 if both groups were in the cart (they are summed together).

### Highest Group Totals (aka Highest Price)

The highest rate of each shipping group for every matching delivery type.

With the Bed/Drawers example the highest group price would be used, so \$50. No matter how many beds/drawers the price would always be \$50.

These totaling algorithms are now rarely used, in part because the i= functionality in the csv algorithm column really caters for most needs. When ProductMatrix was initially written there was per item capability in the csv file.

Please bear in mind that if in doubt don’t use these algorithms, we probably have <1% of our clients using them.

### Per Item Totaling

This will multiple the cart quantity for the particular shipping group by the rate for that group. So in the above example it would be 2*Beds+1*Drawer = \$120.

### Bare Item Totaling

This will multiple the cart quantity for the particular shipping group by the rate for that group. So in the above example it would be 2*Beds+1*Drawer = \$120.

It is called bare as it will match based on each individual item in the cart. So if you say had a Bed that cost \$200 and a Bed that cost \$500 where the shipping price was \$50 and \$70 respectively it would enable you to create rules that looked at the price when it was \$200 and the price when it was \$500. It doesn’t use the total shipping group cart price for matching (unlike all non-bare totaling algorithms).

### Per Product Totaling

This is the same as per item totaling but it takes the combined price of equivalent SKUs. So if I bought 2 Beds that were the same sku & 1 Drawer it would be \$70 but if the beds were different SKU’s it would be \$120.

### Bare Per Product Totaling

Same as Bare Item Totaling but again looks at combined price of equivalent SKUs.