Now the attributes total price is added to the price before the tier prices and it should be after that.
Now:
public static decimal GetUnitPrice(ShoppingCartItem shoppingCartItem, Customer customer,
bool includeDiscounts)
{
decimal finalPrice = decimal.Zero;
var productVariant = shoppingCartItem.ProductVariant;
if (productVariant != null)
{
decimal attributesTotalPrice = decimal.Zero;
var pvaValues = ProductAttributeHelper.ParseProductVariantAttributeValues(shoppingCartItem.AttributesXml);
foreach (var pvaValue in pvaValues)
{
attributesTotalPrice += pvaValue.PriceAdjustment;
}
if (productVariant.CustomerEntersPrice)
{
finalPrice = shoppingCartItem.CustomerEnteredPrice;
}
else
{
finalPrice = GetFinalPrice(productVariant, customer, attributesTotalPrice, includeDiscounts);
if (productVariant.TierPrices.Count > 0)
{
decimal tierPrice = GetTierPrice(productVariant, shoppingCartItem.Quantity);
finalPrice = Math.Min(finalPrice, tierPrice);
}
}
}
finalPrice = Math.Round(finalPrice, 2);
return finalPrice;
}
Good:
public static decimal GetUnitPrice(ShoppingCartItem shoppingCartItem, Customer customer,
bool includeDiscounts)
{
decimal finalPrice = decimal.Zero;
var productVariant = shoppingCartItem.ProductVariant;
if (productVariant != null)
{
decimal attributesTotalPrice = decimal.Zero;
var pvaValues = ProductAttributeHelper.ParseProductVariantAttributeValues(shoppingCartItem.AttributesXml);
foreach (var pvaValue in pvaValues)
{
attributesTotalPrice += pvaValue.PriceAdjustment;
}
if (productVariant.CustomerEntersPrice)
{
finalPrice = shoppingCartItem.CustomerEnteredPrice;
}
else
{
finalPrice = GetFinalPrice(productVariant, customer, 0, includeDiscounts);
if (productVariant.TierPrices.Count > 0)
{
decimal tierPrice = GetTierPrice(productVariant, shoppingCartItem.Quantity);
finalPrice = Math.Min(finalPrice, tierPrice);
}
finalPrice += attributesTotalPrice;
}
}
finalPrice = Math.Round(finalPrice, 2);
return finalPrice;
}