php - Remove tax during checkout in Magento -
a project i’m working on allows customers buy products have ability vat exempt (through disability/chronic sickness). have added additional step checkout process customer can fill in vat exempt form. once form has been filled in need remove tax quote/order.
i have done fair bit of digging how potentially this. below code got far, works moment go through our payment provider tax has been reset. when use check / money order payment option.
file: app/code/local/vat/exempt/controllers/onepagecontroller.php
(method: saveexemptaction()
)
$quote = $this->getonepage()->getquote(); $quote->setcustomertaxclassid(6); // tried forcing custom tax class id $quote->setcustomergroupid(4); //also tried forcing different customer group... foreach($quote->getallitems() $item){ // attempt 0 tax on each item $item->settaxamount(0); $item->setbasetaxamount(0); //re-calculate & save each item. $item->calctaxamount(); $item->save(); } $quote->collecttotals()->save();
any advice appreciated!
the easiest way change customer's group group doesn't pay vat (you can define in sales > tax > manage tax rules).
after fill form change group ($customer->setgroup(self::group_exempt_vat)->save();
) , moment won't pay tax.
let me know if work issue , if need more help.
Comments
Post a Comment