NOP 3.90
Whenever tier pricing is used, tiers that have dates should take priority for tiers without dates
Assume the following scenario:
Item X has a price of 100
Has 2 tier prices for customer role Y:
1st tier price is for quantities starting at 0, price should be 80
2nd tier price is for quantities starting at 0, and start date 1/1/2017, price should be 75
My logic says that the customer should get 75 when he buys the item.
However, the price he will get is random, can get both 75 and 80 depending on the order of the tier prices. In this scenario, will get 80.
The problem is in ProductExtensions.cs - > GetPrefferedTierPrice line 32
The code should be replaced with:
//get actual tier prices
var actualTierPrices = product.TierPrices.OrderBy(price => price.Quantity).OrderBy(price => price.StartDateTimeUtc).ToList()
.FilterByStore(storeId)
.FilterForCustomer(customer)
.FilterByDate();
//Removed .RemoveDuplicatedQuantities();