sabueXo wrote:There is not way to do this with taxes?
It would be useful if you could post a screenshot of the order totals showing that they don't add up but it looks like it could be an oversight in the code to me. Looking at the
PrepareOrderTotalsModel function in the ShoppingCartController you can see this block of code:
//subtotal
decimal orderSubTotalDiscountAmountBase;
List<Discount> orderSubTotalAppliedDiscounts;
decimal subTotalWithoutDiscountBase;
decimal subTotalWithDiscountBase;
var subTotalIncludingTax = _workContext.TaxDisplayType == TaxDisplayType.IncludingTax && !_taxSettings.ForceTaxExclusionFromOrderSubtotal;
_orderTotalCalculationService.GetShoppingCartSubTotal(cart, subTotalIncludingTax,
out orderSubTotalDiscountAmountBase, out orderSubTotalAppliedDiscounts,
out subTotalWithoutDiscountBase, out subTotalWithDiscountBase);
decimal subtotalBase = subTotalWithoutDiscountBase;
decimal subtotal = _currencyService.ConvertFromPrimaryStoreCurrency(subtotalBase, _workContext.WorkingCurrency);
model.SubTotal = _priceFormatter.FormatPrice(subtotal, true, _workContext.WorkingCurrency, _workContext.WorkingLanguage, subTotalIncludingTax);
if (orderSubTotalDiscountAmountBase > decimal.Zero)
{
decimal orderSubTotalDiscountAmount = _currencyService.ConvertFromPrimaryStoreCurrency(orderSubTotalDiscountAmountBase, _workContext.WorkingCurrency);
model.SubTotalDiscount = _priceFormatter.FormatPrice(-orderSubTotalDiscountAmount, true, _workContext.WorkingCurrency, _workContext.WorkingLanguage, subTotalIncludingTax);
model.AllowRemovingSubTotalDiscount = model.IsEditable &&
orderSubTotalAppliedDiscounts.Any(d => d.RequiresCouponCode && !String.IsNullOrEmpty(d.CouponCode));
}
//shipping info
model.RequiresShipping = cart.RequiresShipping();
if (model.RequiresShipping)
{
decimal? shoppingCartShippingBase = _orderTotalCalculationService.GetShoppingCartShippingTotal(cart);
if (shoppingCartShippingBase.HasValue)
{
decimal shoppingCartShipping = _currencyService.ConvertFromPrimaryStoreCurrency(shoppingCartShippingBase.Value, _workContext.WorkingCurrency);
model.Shipping = _priceFormatter.FormatShippingPrice(shoppingCartShipping, true);
//selected shipping method
var shippingOption = _workContext.CurrentCustomer.GetAttribute<ShippingOption>(SystemCustomerAttributeNames.SelectedShippingOption, _storeContext.CurrentStore.Id);
if (shippingOption != null)
model.SelectedShippingMethod = shippingOption.Name;
}
}
The first line in bold shows where the subtotal calculation is taking the
ForceTaxExclusionFromOrderSubtotal setting into account when deciding whether to display the total including or excluding tax. The second line in bold shows that the shipping total calculation doesn't take this setting into account and in fact if you follow the code through the OrderTotalCalculationService you find that it only depends on the TaxDisplayType for the current WorkContext. It might be worth posting in the bugs or suggestions forum where it's likely to get more attention from the nop devs but if you're just looking for a quick fix and don't mind changing core code then it would be relatively easy to fix by changing the second bit of code above to something like this (not tested):
//shipping info
model.RequiresShipping = cart.RequiresShipping();
if (model.RequiresShipping)
{
var shippingIncludingTax = _workContext.TaxDisplayType == TaxDisplayType.IncludingTax && !_taxSettings.ForceTaxExclusionFromOrderSubtotal;
decimal? shoppingCartShippingBase = _orderTotalCalculationService.GetShoppingCartShippingTotal(cart, shippingIncludingTax);
if (shoppingCartShippingBase.HasValue)
{
decimal shoppingCartShipping = _currencyService.ConvertFromPrimaryStoreCurrency(shoppingCartShippingBase.Value, _workContext.WorkingCurrency);
model.Shipping = _priceFormatter.FormatShippingPrice(shoppingCartShipping, true, , _workContext.WorkingCurrency, _workContext.WorkingLanguage, shippingIncludingTax);
//selected shipping method
var shippingOption = _workContext.CurrentCustomer.GetAttribute<ShippingOption>(SystemCustomerAttributeNames.SelectedShippingOption, _storeContext.CurrentStore.Id);
if (shippingOption != null)
model.SelectedShippingMethod = shippingOption.Name;
}
}
I think that would be sufficient to make the display of tax on the shipping amount also depend on the ForceTaxExclusionFromOrderSubtotal setting. It may also require some changes in the MessageTokenProvider service to make sure it gets displayed in the same way in the order confirmation email.