Back to Top

Create Invoice In Magento

Updated 12 February 2018

Create invoice for an order

Suppose order id is 1. Then,

$order = Mage::getModel('sales/order')->load($order_id);
$order->getPayment()->setSkipTransactionCreation(false);
$invoice = $order->prepareInvoice();
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
$invoice->register();
Mage::getModel('core/resource_transaction')
      ->addObject($invoice)
      ->addObject($order)
      ->save();

 

And invoice for that particular order will be created successfully.

Happy coding 🙂

Searching for an experienced
Magento Company ?
Find out More
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home