You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 22, 2019. It is now read-only.
Create a taxing jurisdiction San Diego in AvaTax which will result in a combined 8% rate: CA STATE TAX (6.5%), CA COUNTY TAX (1%), and CA SPECIAL TAX (0.5%)
Place an order for that product. The order's base_tax_amount will be 6.01 (correct) and the tax_amount will be 6.00 (incorrect).
The reason that the base_tax_amount is 6.01 is because AvaTax calculates and rounds the tax for each of the taxing jurisdictions and them combines them:
$75 x 6.5% = 4.875, rounded to 4.88
$75 x 1% = 0.75
$75 x 0.5% = 0.375, rounded to 0.38
Total: 6.01
Explanation of issue
The reason that the tax_amount is incorrectly set to $6.00 is because of this section in \ClassyLlama\AvaTax\Framework\Interaction\TaxCalculation::getTaxDetailsItem. As you can see, this code is built to handle properly calculating rates for non-base currencies, but because it's being applied to the base currency, it's calculating $75 x 6% and is coming up with $6.00.
/**
* Magento uses base rates for determining what to charge a customer, not the currency rate (i.e., the non-base
* rate). Because of this, the base amounts are what is being sent to AvaTax for rate calculation. When we get
* the base tax amounts back from AvaTax, we have to convert those to the current store's currency using the
* \Magento\Framework\Pricing\PriceCurrencyInterface::convert() method. However if we simply convert the AvaTax
* base tax amount * currency multiplier, we may run into issues due to rounding.
*
* For example, a $9.90 USD base price * a 6% tax rate equals a tax amount of $0.59 (.594 rounded). Assume the
* current currency has a conversion rate of 2x. The price will display to the user as $19.80. There are two
* ways we can calculate the tax amount:
* 1. Multiply the tax amount received back from AvaTax, which would be $1.18 ($0.59 * 2).
* 2. Multiply using this formula (base price * currency rate) * tax rate) ((9.99 * 2) * .06)
* which would be $1.19 (1.188 rounded)
*
* The second approach is more accurate and is what we are doing here.
*/
if (!$useBaseCurrency) {
/**
* We could recalculate the amount using the same logic found in this class:
* @see \ClassyLlama\AvaTax\Framework\Interaction\Line::convertTaxQuoteDetailsItemToData,
* but using the taxable amount returned back from AvaTax is the only way to get an accurate amount as
* some items sent to AvaTax may be tax exempt
*/
$taxableAmount = (float)$taxLine->getTaxable();
$amount = $this->priceCurrency->convert($taxableAmount, $scope);
$tax = $amount * $taxLine->getRate();
$tax = $this->calculationTool->round($tax);
}
The text was updated successfully, but these errors were encountered:
Steps to reproduce issue
base_tax_amount
will be 6.01 (correct) and thetax_amount
will be 6.00 (incorrect).base_tax_amount
is 6.01 is because AvaTax calculates and rounds the tax for each of the taxing jurisdictions and them combines them:Explanation of issue
The reason that the
tax_amount
is incorrectly set to $6.00 is because of this section in\ClassyLlama\AvaTax\Framework\Interaction\TaxCalculation::getTaxDetailsItem
. As you can see, this code is built to handle properly calculating rates for non-base currencies, but because it's being applied to the base currency, it's calculating $75 x 6% and is coming up with $6.00.The text was updated successfully, but these errors were encountered: