I am triggering sales_order_save_after
event after order status has been completed.
public function execute(Observer $observer) {
$order = $observer->getEvent()->getOrder();
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$checkoutSession=$objectManager->create('Magento\Checkout\Model\Session');
$status = $checkoutSession->getLastOrderStatus();
if( $status == "complete")
{
echo "<script>javascript: alert ("message") </script>";
}
}
and my event.xml
file in Vendor/Namespace/etc/adminhtml/event.xml
I just want to show this popup when the order is completed in the admin panel of Magento 2 can anyone help to solve it. and how can I get to know my event is triggered or not.