I'm developing av B2B shop, where prices/discounts are fetched from an API when adding to basket. This is done by overriding Mage_Sales_Model_Quote_Item::calcRowTotal.

Now, based on a variable returned from the API, a quote item price may or may not include tax (25%).

Is there any way to apply a tax on a quote item when adding to basket, even when the product itself does not have a tax class in Magento?

I hope this was properly explained. Many thanks!

1 Answer 1


use observer sales_quote_collect_totals_before and in the observers function try to set the tax to the product depending on the condtions using setTaxClassId to the product object

public function newTax($observer){
    $quote = $observer->getQuote();
    foreach ($quote->getAllItems() as $quoteItem)
        $product = $quoteItem->getProduct();
        // here you can assign tax to the product depending on your conditions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.