Blog posts of '2014' 'September'

RSS
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 + ";" :
      Shipping:nn.nn;
e.g.
       Shipping:12.99;
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 :)

Caveat...

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