Here's a simple but useful shipping scenario:
First Item shipping would be £3.50This is easily handled by Shipping Director with a single Option type record:
Type: | Option |
Name: | Shipping Rate |
Expression: | true |
Rate Expression: | 3.50 + ((Items.Sum(Quantity)-1) * 1.00) |
You can even decide to charge different rates for different countries or postal codes. For example, shipping to the Highlands and the islands should be
First Item shipping would be £5.50
Each additional Item adds £1.50
For that, we would just add an OptionExit type record ordered before the previous one.
Type: | OptionExit |
Name: | Shipping Rate |
Expression: | ",AB,BT,DD,HS,IM,IV,KA,PA,PH,TR,ZE,".Contains( Zip.Substring(0,2) ) |
Rate Expression: | 5.50 + ((Items.Sum(Quantity)-1) * 1.50) |
OptionExit will exit with the calculated rate when the "Expression" condition is true. Whereas "Option" with true expression will return the caclulated rate, and continue looking for more Options.
(Note, the above postal codes are just examples. Determining all the actual codes for the Highlands & islands is more complex)
And finally, a little about the "Name:" field. This is the option's name displayed to the customer. In the examples above both Option records used the same Name "Shipping Rate". But, the Highlands Option could have used "Shipping to Highlands and Islands". Or, you can also include a "Name Expression". If none is present, then the "Name" is displayed to the customer. The Name Expression allows you to caclulate the option's name displayed to the customer. For examples, see the other blogs like this one where the weight is included in the option name, and see this blog about using localized resources
UPDATE:
The postal code expression above was updated; in older versions the "Zip" part was written as
ShippingAddress.ZipPostalCode.Substring(0,2)
Additionally, in any version, you should probably have a prior rule to check that a Zip/Postal code was entered, otherwise an error will result - e.g.
ErrorExit String.IsNullOrWhitespace(Zip) "Please enter a zip/postal code"