Blog posts of '2017' 'June'

RSS
A Product's Additional Shipping Charge is the only charge- Saturday, June 10, 2017


Let's say you've assigned Products their own "Additional shipping charge" and you want that charge to be the only charge for those products, and for any other prodcucts in the cart you want to calculate shipping using some 'standard' provider (like FedEx, or By Weight, etc.).    Shipping Director's Packing with Exclude Expression can handle it.  Here's the general idea:

EvalType

Name

Expression

Rate Expression

Description Expression
(Exclude)

Packing

Exclude Addl Charge items

Items.Any(Product.AdditionalShippingCharge > 0)

Packing.FirstFitSingleBox

Product.AdditionalShippingCharge > 0

Option

Shipping

true

Shipping.ByTotal

 

Using Packing's Exclude Expression removes those items from "the cart", so that the Shipping.ByWeight provider does not see them.

Note, that nopCommerce will always add Product.AdditionalShippingCharge AFTER the shipping providers return their methods/rates.  Also, be aware the the AdditionalShippingCharge is per quantity - E.g. if quantity of an item in cart is "3", then 3 times the addl charge is added.  (You can read more about that in this blog about "Product Additional Shipping Charges apply only once to the cart item regardless of the Quantity".

Comments (1)
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)