Skip to content

Instantly share code, notes, and snippets.

@punkstar
Created February 26, 2014 12:46
Show Gist options
  • Save punkstar/9228896 to your computer and use it in GitHub Desktop.
Save punkstar/9228896 to your computer and use it in GitHub Desktop.
A core Magento fix for if you have negative subtotals on invoices after applying at least a 100% discount to the order (but the customer has to pay shipping).
diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Tax.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Tax.php
index 25bbcc7..38587f4 100644
--- a/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Tax.php
+++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Total/Tax.php
@@ -47,7 +47,8 @@ class Mage_Sales_Model_Order_Invoice_Total_Tax extends Mage_Sales_Model_Order_In
$orderItem = $item->getOrderItem();
$orderItemQty = $orderItem->getQtyOrdered();
- if ($orderItem->getTaxAmount() && $orderItemQty) {
+ // Need to check if we've got tax or hidden_tax applied to the item so that we calculate the row subtotal correctly
+ if (($orderItem->getTaxAmount() || $orderItem->getHiddenTaxAmount()) && $orderItemQty) {
if ($item->getOrderItem()->isDummy()) {
continue;
}
@choukalos
Copy link

Thanks for the fix; I've entered it an prioritized in our backlog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment