There is no creditmemo button showing in magento order with total paid amount is 0 after applying discount.
For this I changed canCreditmemo()
function in app/code/local/Mage/Sales/Model/Order.php
.
From :
...
if (abs($this->getStore()->roundPrice($this->getTotalPaid()) - $this->getTotalRefunded()) < .0001) {
return false;
}
...
To :
...
if (abs($this->getStore()->roundPrice($this->getTotalPaid()) - $this->getTotalRefunded()-$this->getDiscountAmount()) < .0001) {
return false;
}
...
After that in order Creditmemo
button showing, creditmemo create successfully, product qty also refunded in magento store.
But after create creditmemo of all products then order status should be closed but in this case order status still complete.
How to change order status to closed for that order?
Best Answer
I have managed to get the order status to closed after a refund two step :-
1->//after the refund code. Calling
Preventing the
sales_order_invoice_save_after
event from firing twice by adding this to the top of my event method:// prevent this event from firing twice
2:-
try another:- In any case, you have two options.
Do a full shipment (dummy if necessary). Refund fully and you should get to Closed automatically.
Go around the restriction by using
instead of
setState.