Site icon Qaisar Satti's Blogs

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

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
}
Exit mobile version