The internet has changed how people shop. Moreover, varied methods of payments, shipping has even made traditional online shopping more customized in order to increase sales and more importantly, customer experience!
However, with such advances, the old-age process of placing an order, payment, invoicing, and then the shipment may be invalid in some cases. For example, the cash on delivery option needs the order to be first shipped, and then the invoice is generated!
To implement the out-of-way function in the Magento 2 store, the foremost requirement is to check the status of an order. You need to check if Magento 2 order is invoiced or shipped and the post tells you how to do so!
Check if the Magento 2 Order is Invoiced:
if ($order->getInvoiceCollection()->count()) { //do your stuff here }
or you can use
if($order->hasInvoices()){ //do your stuff here }
Check if Magento 2 Order is Shipped:
if ($order->getShipmentsCollection()->count()) { //do your stuff here }
or you can use
if ($order->hasShipments()) { //do your stuff here }
So any time you may want to check the order status of your Magento 2 store, bookmark these methods for reference!
Thank you.