0
我正在开展的一个项目允许客户购买能够免除增值税(通过残疾/慢性疾病)的产品。我在结帐过程中增加了一个额外的步骤,以便客户可以轻松填写增值税豁免表格。一旦填写完表格,我需要从报价/订单中删除税款。在Magento结帐时消除税款
我已经做了一些探索,我可以做到这一点。以下是我到目前为止所得到的代码,但它的工作原理,但是当我通过我们的付款提供商时,税款已被重置。即使我使用支票/汇票付款选项。
文件:app/code/local/Vat/Exempt/controllers/OnepageController.php
(方法:saveExemptAction()
)
$quote = $this->getOnepage()->getQuote();
$quote->setCustomerTaxClassId(6); // Tried forcing a custom tax class id
$quote->setCustomerGroupId(4); //also tried forcing a different customer group...
foreach($quote->getAllItems() as $item){
// Attempt to zero the tax on each item
$item->setTaxAmount(0);
$item->setBaseTaxAmount(0);
//re-calculate & save each item.
$item->calcTaxAmount();
$item->save();
}
$quote->collectTotals()->save();
任何建议,将不胜感激!