Remove "Additional Shipping Charge" for In Store Pickup

[updated 10/2014 - replaced ProductVariant with Product]

In the NopCommerce forums, someone had noticed that if you use Fixed Rate shipping but some of your products have "Additional Shipping Charge", that In Store Pickup would still include those charges:

    "...One gotcha - We have items that may individually use the "Additional Shipping Charge" field, and that still factors in.  I had to modify the code and recompile to set this to zero for in-store pickup..."

To remedy this, the user had to modify some code in the core ShippingService module to zero out the rate.    With the Shipping Director, it's easy to modify the rate.

Let's say we have set up Fixed Shipping rate for In Store Pickup ($0.00) and Ground ($9.95).   Then, we set up a Shipping Director option to use the Shipping.FixedRate plugin

If we have a product with an Additional Shipping Charge of $0.99, and add two of those in my shopping cart and estimate shipping I see:

In-Store Pickup ($1.98)
Pick up your items at the store
By Ground ($11.93)
Cost-effective ground shipping

We can negate the Additional Shipping Charge easily by using the Surcharge Expression with a minus sign prefix:

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

But, we only want to negate it when the rate option name is "In-Store Pickup", so we use the ternary if-then-else operator "  ?  :  "

  [$Name].Contains("Pickup") ? -(Items.Where(Product.AdditionalShippingCharge > 0).Sum(Quantity * Product.AdditionalShippingCharge)) : 0

In-Store Pickup ($0.00)
Pick up your items at the store
By Ground ($11.93)
Cost-effective ground shipping

Tags :  InStorePickup
Comments
Leave your comment
:
sample@email.tst
Created on: 6/26/2023 5:31 PM
1
sample@email.tst
Created on: 6/26/2023 5:31 PM
1