Magento won't let you create a credit memo for $0. In the case of a $0 order, what is the correct way to reverse/close/cancel the order, and return the item to stock?
From looking at the core code, it looks like Magento has some reason for not allowing credit-memos for $0 orders, but I can't understand what it is (although that isn't what this question is about.)
The order's canCreditmemo() method returns false if the total minus the refunded is zero (which it always will be for a $0 order).
if (abs($this->getStore()->roundPrice($this->getTotalPaid()) - $this->getTotalRefunded()) < .0001) {
return false;
}
In the credit memo controller, it requires that you enter a positive number, but for a $0 order, there is no actual money to refund or credit.
if (($creditmemo->getGrandTotal() <=0) && (!$creditmemo->getAllowZeroGrandTotal())) {
Mage::throwException(
$this->__('Credit memo\'s total must be positive.')
);
}
You are probably wondering why on earth this is a use-case:
Our client was creating a manual order through the admin for someone. The order total was (intentionally) $0. Unfortunately, they "purchased" the wrong product, which throws off their inventory and their reports. We ended up setting the order to "Canceled" status manually by calling $order->setStatus('Canceled');
, but to me this isn't a very ideal solution because it doesn't return the item to stock, nor does it save any history of what happened, such that a future user could understand that the product was/wasn't returned to stock.
As a Magento developer, what would you advise your client to do in this scenario?
Since this is Magento stack-exchange, "Use a real ERP and inventory management system" is not an answer.