diff --git a/src/Libraries/SmartStore.Services/Orders/IOrderTotalCalculationService.cs b/src/Libraries/SmartStore.Services/Orders/IOrderTotalCalculationService.cs
index d833b5df4b..3f5ee14bb5 100644
--- a/src/Libraries/SmartStore.Services/Orders/IOrderTotalCalculationService.cs
+++ b/src/Libraries/SmartStore.Services/Orders/IOrderTotalCalculationService.cs
@@ -67,12 +67,12 @@ decimal GetOrderSubtotalDiscount(Customer customer,
///
/// Adjust shipping rate (free shipping, additional charges, discounts)
///
- /// Shipping rate to adjust
+ /// Shipping option
/// Cart
/// Applied discount
/// Adjusted shipping rate
- decimal AdjustShippingRate(decimal shippingRate, IList cart,
- string shippingMethodName, IList shippingMethods, out Discount appliedDiscount);
+ decimal AdjustShippingRate(decimal shippingRate, IList cart,
+ ShippingOption shippingOption, IList shippingMethods, out Discount appliedDiscount);
///
/// Gets shopping cart additional shipping charge
diff --git a/src/Libraries/SmartStore.Services/Orders/OrderTotalCalculationService.cs b/src/Libraries/SmartStore.Services/Orders/OrderTotalCalculationService.cs
index 73289a133b..d2fbbd50e7 100644
--- a/src/Libraries/SmartStore.Services/Orders/OrderTotalCalculationService.cs
+++ b/src/Libraries/SmartStore.Services/Orders/OrderTotalCalculationService.cs
@@ -206,7 +206,7 @@ protected virtual void PrepareAuxiliaryServicesTaxingInfos(IList cart)
/// Applied discount
/// Adjusted shipping rate
public virtual decimal AdjustShippingRate(decimal shippingRate, IList cart,
- string shippingMethodName, IList shippingMethods, out Discount appliedDiscount)
+ ShippingOption shippingOption, IList shippingMethods, out Discount appliedDiscount)
{
appliedDiscount = null;
- //free shipping
- if (IsFreeShipping(cart))
- return decimal.Zero;
+ if (IsFreeShipping(cart))
+ {
+ return decimal.Zero;
+ }
- decimal adjustedRate = decimal.Zero;
- decimal bundlePerItemShipping = decimal.Zero;
- bool ignoreAdditionalShippingCharge = false;
- ShippingMethod shippingMethod;
+ var adjustedRate = decimal.Zero;
+ var bundlePerItemShipping = decimal.Zero;
+ var ignoreAdditionalShippingCharge = false;
foreach (var sci in cart)
{
@@ -695,7 +695,9 @@ public virtual decimal AdjustShippingRate(decimal shippingRate, IList x.Item.IsShipEnabled && !x.Item.IsFreeShipping))
+ {
bundlePerItemShipping += shippingRate;
+ }
}
}
else if (adjustedRate == decimal.Zero)
@@ -706,22 +708,25 @@ public virtual decimal AdjustShippingRate(decimal shippingRate, IList x.Name.IsCaseInsensitiveEqual(shippingMethodName))) != null)
+ if (shippingOption != null && shippingMethods != null)
{
- ignoreAdditionalShippingCharge = shippingMethod.IgnoreCharges;
+ var shippingMethod = shippingMethods.FirstOrDefault(x => x.Id == shippingOption.ShippingMethodId);
+ if (shippingMethod != null)
+ {
+ ignoreAdditionalShippingCharge = shippingMethod.IgnoreCharges;
+ }
}
- //additional shipping charges
+ // Additional shipping charges.
if (!ignoreAdditionalShippingCharge)
{
decimal additionalShippingCharge = GetShoppingCartAdditionalShippingCharge(cart);
adjustedRate += additionalShippingCharge;
}
- //discount
+ // Discount.
var customer = cart.GetCustomer();
- decimal discountAmount = GetShippingDiscount(customer, adjustedRate, out appliedDiscount);
+ var discountAmount = GetShippingDiscount(customer, adjustedRate, out appliedDiscount);
adjustedRate = adjustedRate - discountAmount;
if (adjustedRate < decimal.Zero)
diff --git a/src/Presentation/SmartStore.Web/Controllers/CheckoutController.cs b/src/Presentation/SmartStore.Web/Controllers/CheckoutController.cs
index eb951f3a55..e4438f65d7 100644
--- a/src/Presentation/SmartStore.Web/Controllers/CheckoutController.cs
+++ b/src/Presentation/SmartStore.Web/Controllers/CheckoutController.cs
@@ -215,7 +215,7 @@ protected CheckoutShippingMethodModel PrepareShippingMethodModel(IList