Per Item Shipping by Zone and Category

Calculation Per item shipping charges can be a bit tricky.  Consider that the complexity is that the cart can contain multiple items in different categories, and thus you need to have some kind of "per item" shipping calculation that group items by category.  There are two ways to do this with Shipping Director.

1) "Configure" in Shipping Director all the zone/rate calculations.  See this basic example about per item shipping


Here's some basic configuration using an "if then else" operator " ? :" to calculate Zone from Zip (postal code) - e.g.

Integer       Zone      Zip <= "1000" ? 1 : Zip < "2000" ? 2 : Zip < "3000" ? 3 : 4

then for each category either count the items, or sum the Quantity - e.g.

Decimal     Category1Count         Items.Where(Product.HasCategory("Category1")).Sum(Quantity)
Decimal     Category2Count         Items.Where(Product.HasCategory("Category2")).Sum(Quantity)
...

then calculate total rate by summing individual category rates by zone:

Decimal     Rate            0
Decimal     Rate            [Rate] + Category1Count * ([Zone] = 1 ? 5.00 : [Zone] = 2 ? 7.00 : [Zone] = 3 ? 9.00 : 10.00)
Decimal     Rate            [Rate] + Category2Count * ([Zone] = 1 ? 6.00 : [Zone] = 2 ? 8.00 : [Zone] = 3 ? 11.00 : 13.00)
...
Option       Shipping       true         [Rate]

The above example does not take into account any consideration for different rates for the first item vs. additional items.  For example, if the first item ships for $5.00 and each additional item ships for $2.00.   First, you need to consider if the calculation is specific for Product quantity or Category quantity (as per above example "counts").


2)  If you have so many Zones and Categories and you frequently need to change rates, then you may want to set up some tables in SQL Server, and a custom Stored Procedure can be written to do the calculation.  Here's a blog with an example using Zone/Weight, but note it's 'total cart weight' and doing individual categories would need different coding.  Note that Shipping Director does not have a GUI to maintain the lookup tables.  You (or your IT person) would need some time of tool (like SSMS) to maintain (insert or update) rates.  (In the future, we plan on adding a feature to SD to allow uploading such data into SQL tables.)

(Also, note: if your products have Product Attributes that need special shipping rate calculations / additional $, then it becomes more complex.  And, you may want to 'validate' the postal code, because it is just a free form text field.)

Tags :  RatePerItem
Comments
Leave your comment
: