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
}
Qaisar Satti
Hi, I'm Qaisar Satti! I've been a developer for over 20 years, and now I love sharing what I've learned through tutorials and guides. Whether you're working with Magento, PrestaShop, or WooCommerce, my goal is to make your development journey a bit easier and more fun. When I'm not coding or writing, you can find me exploring new tech trends and hanging out with the amazing developer community. Thanks for stopping by, and happy coding!