The following code creates a Magento credit memo / refund.
1 2 3 4 5 6 7 8 9 10 11 |
$invoices = array(); foreach ($this->getInvoiceCollection() as $invoice) { $invoices[] = $invoice; } $service = Mage::getModel('sales/service_order', $this); foreach ($invoices as $invoice) { $creditmemo = $service->prepareInvoiceCreditmemo($invoice); $creditmemo->register(); $creditmemo->save(); } |
Creating a credit memo / refund programmatically
You want or need help implementing this solution? Maybe you did not find what you were looking for? Contact me and I will assist you with whatever Magento problem troubles you!