I have 2 discount in setup:
1. Assigned to products - with no requirement and cumulative with other discounts = False.
2. Assigned to Order total with requirement by order sum with cumulative with other discounts = False.
But in result i see that both discounts applyed to shopping cart.
My question is why and what is the purpose of setup cumulative with other discounts.
Some code:
OrderTotalCalculationService
protected virtual decimal GetOrderTotalDiscount(Customer customer, decimal orderTotal, out List<DiscountForCaching> appliedDiscounts)
{
appliedDiscounts = new List<DiscountForCaching>();
decimal discountAmount = decimal.Zero;
if (_catalogSettings.IgnoreDiscounts)
return discountAmount;
var allDiscounts = _discountService.GetAllDiscountsForCaching(DiscountType.AssignedToOrderTotal);
//TODO:: I think some path of logic missing there?????
//TODO::
var allowedDiscounts = new List<DiscountForCaching>();
if (allDiscounts != null)
foreach (var discount in allDiscounts)
if (_discountService.ValidateDiscount(discount, customer).IsValid &&
!allowedDiscounts.ContainsDiscount(discount))
{
allowedDiscounts.Add(discount);
}
appliedDiscounts = allowedDiscounts.GetPreferredDiscount(orderTotal, out discountAmount);
if (discountAmount < decimal.Zero)
discountAmount = decimal.Zero;
if (_shoppingCartSettings.RoundPricesDuringCalculation)
discountAmount = RoundingHelper.RoundPrice(discountAmount);
return discountAmount;
}