BenLivingston Posted September 5, 2013 Share Posted September 5, 2013 (edited) One problem (of many) I'm working around in PrestaShop is how to sell gift cards without tax. The products are set to virtual, but PrestaShop still includes them in the total tax calculation. To fix this, in classes/Cart.php in the function getOrderTotal(), change this bit of code: if ($with_taxes) { $product_tax_rate = (float)Tax::getProductTaxRate((int)$product['id_product'], (int)$address_id, $virtual_context); $product_eco_tax_rate = Tax::getProductEcotaxRate((int)$address_id); $total_price = ($total_price - $total_ecotax) * (1 + $product_tax_rate / 100); $total_ecotax = $total_ecotax * (1 + $product_eco_tax_rate / 100); $total_price = Tools::ps_round($total_price + $total_ecotax, 2); } With this: if ($with_taxes) { // ben $product_tax_rate = 0; if (empty($product['is_virtual'])) $product_tax_rate = (float)Tax::getProductTaxRate((int)$product['id_product'], (int)$address_id, $virtual_context); $product_eco_tax_rate = Tax::getProductEcotaxRate((int)$address_id); $total_price = ($total_price - $total_ecotax) * (1 + $product_tax_rate / 100); $total_ecotax = $total_ecotax * (1 + $product_eco_tax_rate / 100); $total_price = Tools::ps_round($total_price + $total_ecotax, 2); } That worked for me, at least. -- Ben Edited September 5, 2013 by BenLivingston (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts