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();
任何建議,將不勝感激!