:::: MENU ::::

How to check order is invoiced or shipped in magento 2?

Recent QuestionsCategory: Magento 2 QuestionsHow to check order is invoiced or shipped in magento 2?
waqar asked 2 weeks ago

i am creating invoice and shipping pragmatically, but first i want to check there is already invoice or shipment created

1 Answers
Best Answer
qaisarsatti Staff answered 2 weeks ago

Invoice Check

There are tow ways to check invoice is created or not.

First

if($order->hasInvoices()):

//do your stuff here

endif;

Second

if ($order->getInvoiceCollection()->count()) {
        //do your stuff here
}

Shipment Check

There are tow ways to check Shipment is created or not.

First

if($order->hasShipments()):

//do your stuff here

endif;

Second

if ($order->getShipmentsCollection()->count()) {
        //do your stuff here
}