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

Questions

QuestionsCategory: Magento 2 QuestionsHow to check order is invoiced or shipped in magento 2?
waqar asked 7 years ago
0 Answers
Qaisar Satti Staff answered 7 years 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
}