Chat on WhatsApp

Observer or plugin for "after order placed" logic?

Use a plugin on Magento\Sales\Api\OrderManagementInterface::place. The historic sales_order_place_after observer still fires, but it runs inside the same DB transaction as the order save, so any exception you throw rolls back the order — rarely what you want. A plugin gives you a clean afterPlace($subject, $result) hook where you can dispatch an async queue message, send an email, or fire a webhook without endangering the order itself. If you need the quote rather than the order, use Magento\Quote\Api\CartManagementInterface::placeOrder instead — it returns the order ID.

Was this helpful?