I am making a module where I am getting Invoice Increment id but I need Order Increment id. How to get the Order Increment Id by using Invoice Increment id?
If anyone has ideas please let me know.
Thanks.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityI am making a module where I am getting Invoice Increment id but I need Order Increment id. How to get the Order Increment Id by using Invoice Increment id?
If anyone has ideas please let me know.
Thanks.
Try this:
$invoice = $invoiceModel->loadByIncrementId('000000011');// Your invoice increment id here
$order = $invoice->getOrder();
$incrementId = $order->getIncrementId();
Where invoiceModel is an instance of \Magento\Sales\Model\Order\Invoice