If an item is FreeShipping, then subtotal does not contain respective amount but its weight is still in GetTotalWeight of cart. Shouldn't there be a correction for it? If it's free then it should be free in every aspect.

Here a possible fix.


decimal weightFreeShipping = decimal.Zero;

                foreach (var packageItem in getShippingOptionRequest.Items)
                {
                    if (packageItem.ShoppingCartItem.IsFreeShipping)
                    {
                        weightFreeShipping += _shippingService.GetShoppingCartItemWeight(packageItem.ShoppingCartItem) * packageItem.GetQuantity();
                        continue;
                    }
                    //TODO we should use getShippingOptionRequest.Items.GetQuantity() method to get subtotal
                    subTotal += _priceCalculationService.GetSubTotal(packageItem.ShoppingCartItem);
                }

                //items with free shipping should not be considerated in weight calculation
                var weight = Math.Max(_shippingService.GetTotalWeight(getShippingOptionRequest) - weightFreeShipping, decimal.Zero);