Problem
We are currently implementing the Dots/FastTax plugin to extend from the initial Mage_Tax_Model_Calculation
class. By doing so, we are able to provide a dynamic tax rate for both cart estimate tax quote and actual checkout.
The issue, however, is that tax is currently showing on an initial session. In other words, when a user adds an item to the cart and proceeds to checkout cart, you can see a default tax amount. This default tax amount usually is estimated to 8%
of the total item cost.
Discussion
The plugin is responsible for one key method extension, that is the calcTaxAmount
:
/**
* Calculate rated tax based on price and tax rate.
* If you are using price including tax $priceInclude should be true.
*
* @param float $price
* @param float $taxRate
* @param boolean $priceIncludeTax
* @param boolean $round
* @return float
*/
public function calcTaxAmount($price, $taxRate, $priceIncludeTax = false, $round = true)
{
$taxRate = 0.00;
if (in_array($this->shippingState, $this->taxableStates)) {
$dots_helper = Mage::helper('DOTS_FastTax/DOTS');
$taxRate = $dots_helper->getTaxRate();
}
if ($priceIncludeTax) {
$amount = $price * (1 - 1 / (1 + $taxRate));
} else {
$amount = $price * $taxRate;
}
if ($round) {
return $this->round($amount);
}
return $amount;
}
In the above implementation, we verify that the shipping state (the state to which the product will ship to) is available in a list of pre-configured taxable states (states to which we would like tax to apply). If so, we use a helper object to get the tax rate. The tax returns a decimal value. Since this is the only method to which we extend from the initial object, I am assuming all other behavior is inherited from the parent.
Question
Is there a way to hide the tax rate on cart summary until the user has engaged the Estimate Shipping and Tax Estimate field?