Blog posts tagged with 'RatePerItem'

Per Item Shipping by Zone and Category- Saturday, June 10, 2017
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 (0)
Product Specific Fixed Rate for Quantity 1 plus Additional Shipping Charge for Quantity > 1- Wednesday, September 10, 2014
This example will allow you to maintain fixed rates at the product level using Admin Comment and also use the Product's Additional Shipping Charge.

Here's the magic formula :)

Items.Where(!String.IsNullOrWhiteSpace(Product.AdminComment)).Sum(Decimal.Parse(Product.AdminComment.SubstringBetween("Shipping:",";")) - Product.AdditionalShippingCharge)

It will parse out a Quantity 1 rate from Admin Comment, but be sure to use the format "Shipping" + ":" + rate + ";" :
You can still use the rest of the Admin Comment as needed, either before, or after the Shipping:nn.nn;
You can change the format if you want - e.g.  livraison:nn.nn|   
But then be sure that you adjust the SubstringBetween expression.   (You can also use  Product.AdminComment.ToLower(), if you want to be safer :)


nopCommerce always adds the products' Additional Shipping Charges AFTER it gets the rate from a shipping plugin.  And, thus when you use the TEST button in Shipping Director, it will NOT show any additional charges.  If you use the Estimate Shipping in the public cart, then you will see the added charges.  Note the " - Product.AdditionalShippingCharge"  (minus) in the above expression.  That ensures that the Product.AdditionalShippingCharge does not apply to the first quantity of the product.  However, if you need also do some type of free shipping (e.g. free for domestic, and above per-item rates only for international), then you can't use the Product's Additional Shipping Charge, and must adjust the above scenario to also include the per-one rate as another element in the Admin Comment, and parse it out.

You can download the above configuration that you can then import into Shipping Director.
Tags :  RatePerItem
Comments (0)
Per Item Shipping Rates- Tuesday, June 12, 2012

Here's a simple but useful shipping scenario:

First Item shipping would be £3.50
Each additional Item adds £1.00

So, for example, 3 items would be £3.50 + £1 + £1 = £5.50

This is easily handled by Shipping Director with a single Option type record:




Shipping Rate



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.  




Shipping Rate


",AB,BT,DD,HS,IM,IV,KA,PA,PH,TR,ZE,".Contains( ShippingAddress.ZipPostalCode.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

Tags :  RatePerItem
Comments (2)