Hot answers tagged

19 votes
Accepted

How to Perform Invoice Capture in Magento2 Programmatically

It's pretty similar to M1 in Magento 2, you need to inject the Magento\Sales\Model\Service\InvoiceService in your class: protected $_invoiceService; public function __construct( ... \Magento\...
Raphael at Digital Pianism's user avatar
10 votes

Payment has already been made for this InvoiceID (#10412: Duplicate invoice)

I think, this issue accrues when we have multiple instance of website. In case you have multiple development instance of website. You need to allow "Accept Duplicate Invoice" from Paypal. In order ...
Pankaj Sharma's user avatar
10 votes
Accepted

How do I get Order invoice details from order id

As per as,magento2 standard,you can inject Sales Collection Factory class, protected $order; public function __construct( ..... \Magento\Sales\Model\OrderFactory $order, ....... ) { ... ...
Jeya Kiruthika's user avatar
8 votes
Accepted

Magento 2: How to add footer in pdf invoice?

For pdf, Pdf Starts Calculation from Bottom-Left Corner of Page and by default is measured in points. Start with X and Y axis at left bottom page. We have to set based on our requirements set $this->...
Rakesh Jesadiya's user avatar
8 votes
Accepted

Magento2 - plugin / event after invoice is created

I finally solved this using sales_order_invoice_pay event, which is fired both in admin & frontend scopes
Raul Sanchez's user avatar
  • 3,217
8 votes
Accepted

Magento 2, add `company's name` in invoice PDF file?

Override AbstractPdf.php vendor\magento\module-sales\Model\Order\Pdf\AbstractPdf.php Go To Line number 397 (protected function insertOrder(&$page, $obj, $putOrderId = true)) & after put ...
Shorabh's user avatar
  • 1,510
7 votes

How do I get Order invoice details from order id

you can try the below code. $orderId = $this->getRequest()->getParam('orderNum'); $order = $this->orderFactory->create()->loadByIncrementId($orderId); $invoice_details = $order->...
Jjo's user avatar
  • 1,148
7 votes
Accepted

Magento 1.9 - How to add serial number in sales orders list & invoice list?

Please follow below step to add SR No into Sales order items list. Open app/design/adminhtml/default/default/template/sales/order/view/items.phtml file and replace with below code. <?php $...
Bhavin Pethani's user avatar
6 votes

Magento 1.9.x Removing the invoice link from Account Order info pages

Yes you can but you will need a small module to override the sales/order_info block. Here is how your module config.xml should look like: <?xml version="1.0" encoding="UTF-8"?> <config> ...
Raphael at Digital Pianism's user avatar
6 votes
Accepted

Where does Magento store Pdf Invoices?

Magento doesn't store PDF files, it generates PDF on demand. It keeps all the required data in different tables and compose the PDF based on configurations and PDF template.
Aman Srivastava's user avatar
6 votes

Magento 2 order flow sequence

first of all, it's worth mentioning that COD (Cash on Delivery) is an off-line payment method in Magento, which means that - upon order placement - no payment in registered in Magento, and the order ...
Dmitri Sologoubenko's user avatar
6 votes
Accepted

Magento 2: How to Automatically Create Invoice from Order Observer

As pointed out, the answer to this is that I was using the wrong event. With the event sales_order_save_after the order hasn't been committed to the Database yet. I changed my event to fire on ...
AJK's user avatar
  • 741
6 votes
Accepted

Create shipment and invoice in mass action

I recently worked on this feature both (Invoice and Shipment). First you have to add Uicomponent in your module Path: app\code\Vendor\Module\view\adminhtml\ui_component\sales_order_grid.xml <?xml ...
Muhammad Hasham's user avatar
6 votes
Accepted

Rearrange the position of subtotal,shipment,tax in pdf invoice magento 2

The sorting of the totals in the pdf is driven by the sort order assigned in the pdf.xml files. To for example change the sort order of tax create a new custom module and place into it the following ...
Kristof at Fooman's user avatar
5 votes

Send invoice e-mail based on customer group

Magento selects it's templates from app/locale/{LANGUAGE_CODE}/template/email/sales/invoice_new.html or app/locale/{LANGUAGE_CODE}/template/email/sales/invoice_new_guest.html It selects the correct ...
Jeroen's user avatar
  • 2,938
5 votes

how to get invoice id or details from order?

Your code only provides the one invoice which has been created first for this order. But an order may have multiple invoices as Magento is capable of creating multiple partial invoices, then you will ...
Amit Bera's user avatar
  • 77.2k
5 votes

Magento 2 : How to edit invoice PDF

You can override this file and do your change which you want in PDF vendor/magento/module-sales/Model/Order/Pdf/AbstractPdf.php
Ashish Jagnani's user avatar
5 votes

Magento 2 change Invoice PDF Font and Add logo and mailing Address in Footer

I have tried with module https://github.com/EaDesgin/magento2-pdf-generator2 but this module very complex and provide features if you buy it.I have not used this module and decide to make custom ...
akgola's user avatar
  • 2,897
5 votes
Accepted

Load invoice by invoice id and invoice increment id

Try this private $invoice; public function __construct( .... \Magento\Sales\Model\Order\Invoice $invoice ) { .... $this->invoice = $invoice; } .... .... // load invoice using ...
Dinesh Yadav's user avatar
  • 6,397
4 votes
Accepted

Magento : Invoice : draw table on product list

First of all overwrite invoice.php in local (which is in Mage_Sales_Model_Order_Pdf_Invoice) Before call _drawItem define a variable for $startTable=$this->y; After _drawItem function $page = $...
Shan13's user avatar
  • 66
4 votes

Observer on sales_order_invoice_save_after

This is a somewhat older question but I ran into the same situation where I needed this. I came up with what I think is a more elegant solution by comparing the 'created at' and 'updated at' date/time ...
Marco Miltenburg's user avatar
4 votes
Accepted

Remove Coupon Code from invoice

You can rewrite the method _initTotals from the block Mage_Adminhtml_Block_Sales_Order_Invoice_Totals and make it look like this: protected function _initTotals() { $this->getSource()->...
Marius's user avatar
  • 198k
4 votes

How to customise invoice pdf layout in magento2?

For customization or changing layout of pdf invoice we use zend framework's library functions and we need to override some files like: Magento\Sales\Model\Order\Pdf\Invoice Magento\Sales\Model\Order\...
Deepak's user avatar
  • 81
4 votes

Magento 2 : Add Custom Field To Order, Invoice, Shipment, Credit Memo

I give my answer about order email. Other emails and pdf should works with the same logic. You have to look at \vendor\magento\module-sales\view\frontend\layout\sales_email_order_items.xml where the ...
LucScu's user avatar
  • 2,323
4 votes
Accepted

How to create Barcode to invoice ID and separate the product image Magento 2.1.5?

I'll take a stab at question #1 to include the invoice barcode in the pdf header. The header is draw in Magento\Sales\Model\Order\Pdf\Invoice::insertDocumentNumber which currently uses the function ...
Pmclain's user avatar
  • 2,568
4 votes

Magento 2: How to Automatically Create Invoice from Order Observer

Automatically Create Invoice after place the order from Order Observer using event checkout_submit_all_after. Follow below file path to create custom module and makes auto invoice after place order. ...
Kirti Nariya's user avatar
  • 3,421
4 votes
Accepted

How to get the product image in invoice email template?

My problem has been solved (thanks to xdebug :) by replacing $_item->getProduct() that I used in the order email template with $_item->getOrderItem()->getProduct() That's after noticing that ...
Hassan Al-Jeshi's user avatar
4 votes
Accepted

Magento 2 - After invoice delete programatically can't create new invoice properly

Looking at your code, I guess you miss the trick. You have to set order items fields to 0 which are effected by creating invoice. Replace your item foreach with this. $items = $order->getAllItems(...
Muhammad Hasham's user avatar
4 votes
Accepted

how to edit Invoice pdf in magento 2.3

override of the abstract class in app\code{Vendor}\Module\Model\Order\Pdf\Invoice.php In my case i'm hide that 'red boarded table and update below function insertOrderCustom and adjust element ...
Shafeel Sha's user avatar
  • 1,385
4 votes
Accepted

Magento2 - How to get order id in 'sales_order_invoice_pay' observer?

Try the following way: /** @var \Magento\Sales\Model\Order\Invoice $invoice */ $invoice = $observer->getEvent()->getInvoice(); $order = $invoice->getOrder(); $incrementId = $order->getIncrementId();
Sohel Rana's user avatar
  • 35.6k

Only top scored, non community-wiki answers of a minimum length are eligible