Relevant Code (nopCommerce 1.8):
protected decimal GetTaxRate(Address address, int taxCategoryID)
{
int CountryID = 0;
int StateProvinceID = 0;
if (address.Country != null)
{
CountryID = address.Country.CountryId;
}
if (address.StateProvince != null)
{
StateProvinceID = address.StateProvince.StateProvinceId;
}
decimal tr = decimal.Zero;
var taxRates = TaxRateManager.GetAllTaxRates(taxCategoryID, CountryID, StateProvinceID, address.ZipPostalCode);
if (taxRates.Count > 0)
tr += taxRates[0].Percentage;
return tr;
}
What I don't understand is the bit about :
if (taxRates.Count > 0)
tr += taxRates[0].Percentage;
That doesn't make sense to me. You're returning a list of all available tax rates, however you're only adding/returning the first one? I think I'm right, however wanted a second/third opinion in case I'm misunderstanding something.