Blog posts of '2017' 'May'

RSS
Product Additional Shipping Charges apply only once to the cart item regardless of the Quantity- Saturday, May 6, 2017

nopCommerce always adds the Additional Shipping Charges after getting rates from the Shipping Providers.  I've blogged about how to use the Shipping Director to conditionally negate the Additional Shipping Charges.  It's easily done by using the Surcharge Expression as described here:

https://www.noptools.com/blog/11/remove-additional-shipping-charge-for-in-store-pickup

In this example, we’ll show how to have the Product Additional Shipping Charge apply only once to the cart item regardless of the Quantity entered by customer.

The ‘magic’ is to calculate the Product Additional Shipping Charges that would be added by nopCommerce and use the Surcharge Expression to negate them.  But in this case, to also calculate, and add back, those charges as if only one charge per item rather than one charge per Quantity.

Order

Type

Name

Expression

RateExpression

SurchargeExpression

10

Decimal

TotalAddlShippingCharge

Items.Where(Product.AdditionalShippingCharge > 0).Sum(Quantity * Product.AdditionalShippingCharge)

 

 

20

Decimal

PerItemAddlShippingCharge

Items.Where(Product.AdditionalShippingCharge > 0).Sum( Product.AdditionalShippingCharge)

 

 

100

Option

Shipping By Total

true

Shipping.FixedByWeightByTotal

-[TotalAddlShippingCharge] + [PerItemAddlShippingCharge]

You can download the configuration import file by clicking on this link ShippingDirector (By Total - Only One Product Addl Ship Charge per item).txt

(UPDATE.  The above FixedByWeightByTotal used to be just ByTotal in older versions of nopCommerce)

Comments (2)