2

Hello Friends I want to remove the tax of the product in specific condition.I tried to set taxclass id as 0 but it adds the total of tax and product orice I want to completely remove the tax please help . Currently this is my code which I used to remove tax

 $tax=Mage::helper('checkout')->getQuote()->getShippingAddress()->getData('tax_amount');        
 $inc_tax=$product->getPrice();
 $exc_tax=$inc_tax-$tax;$product->setPrice($exc_tax);
 $finalPrice=$exc_tax;
 $product->setTaxClassId(0);

Please help me .

Keyul Shah
  • 7,219
  • 12
  • 37
  • 60
Pratik bhatt
  • 1,490
  • 13
  • 37

1 Answers1

1

Try creating an observer sales_quote_add_item

<events>
    <sales_quote_add_item>
        <observers>
            <priceupdate_observer>
                <type>singleton</type>
                <class>mymodule/observer</class>
                <method>updatePrice</method>
            </priceupdate_observer>
        </observers>
    </sales_quote_add_item>
</events>

Then reset the values that charges tax

public function updatePrice($observer) {
    $event = $observer->getEvent();
    $quote_item = $event->getQuoteItem();

    $quote_item->setTaxPercent(0);
    $quote_item->setTaxAmount(0);
    $quote_item->setBaseTaxAmount(0);

    $quote_item->setPriceInclTax($quote_item->getPrice());
    $quote_item->setBasePriceInclTax($quote_item->getBasePrice());
    $quote_item->setBaseRowTotalInclTax($quote_item->setBaseRowTotal());

    $quote_item->save();
}

See Changing the price in quote while adding product to cart: magento

MagePal Extensions
  • 13,911
  • 2
  • 33
  • 52