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\...
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 ...
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,
.......
) {
...
...
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->...
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
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 ...
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->...
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 $...
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.
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 ...
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 ...
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 ...
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 ...
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
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 ...
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 ...
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\...
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 ...
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 ...
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.
...
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 ...
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(...
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 ...
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();
3
votes
Magento 2: How to add footer in pdf invoice?
The x and y coordinate in Pdf aren't easy, we should calcuate by ourself.
First of all, we need to override the getPdf method of Invoice Pdf
Module/Vendor/Model/Order/Pdf/Invoice.php
public ...
3
votes
how to change PDF invoice layout
I have used the above answers with a combination of Zend_Pdf module (https://framework.zend.com/manual/1.12/en/zend.pdf.usage.html) to create some extra space and lines between the items in the Pdf ...
3
votes
Remove the invoice link from the customer account page in Magento 2
Found it.
Create this file within your theme dir:
<theme_dir>/Magento_Sales/layout/sales_order_info_links.xml
Then you can remove links with this:
<?xml version="1.0"?>
<page xmlns:...
3
votes
Magento 2: How to stop order from Invoicing Programmatically?
In order to stop create an invoice when customer done Payment with Paypal.
Then need to rewrite class the model class Magento\Paypal\Model\Ipn and stop create invoice at function ...
3
votes
Accepted
Magento 2: How to Add another block in sales/invoice page.
First,you need to create custom module:
Via custom module
If you donot want to work at direct vendor folder then you need create a custom module
This module should consist of below files:
app/...
3
votes
Accepted
get order id in Observer on sales_order_invoice_save_after
You can get orderId by using this way,
$invoice = $observer->getEvent()->getInvoice();
$order = $invoice->getOrder();
$orderId=$order->getId();
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
invoice × 713magento2 × 183
magento-1.9 × 176
pdf × 167
orders × 106
email × 51
sales-order × 46
event-observer × 33
magento-1.7 × 32
create-invoice × 27
magento-1.8 × 25
admin × 25
sales × 23
magento-2.1 × 22
email-templates × 22
shipment × 22
print × 21
tax × 20
order-status × 19
creditmemo × 19
payment × 18
shipping × 17
payment-methods × 17
order-email × 17
magento2.3 × 16