I am using the event <sales_order_place_after> in my observer to perform some action. I am inserting the Order ID in my custom table. But what I observe is that it does not give me Order ID but instead Increment ID, which I am fetching using getReservedOrderId().

Now to fetch Order ID from Increment ID I can use,

$order = Mage::getModel('sales/order')->load($incrementId, 'increment_id');

but I need to insert the data at the time of order placed, instead of fetching it again.

Observer Code;

$order = $observer->getEvent()->getOrder(); //returns null

So I am using

$order = $observer->getEvent()->getOrder()->getQuote();

Which event should be used in order to get all order details after an order is placed or on order success ?

4 Answers 4


There are lot of event in magento order place.

I have preferred checkout_submit_all_after event which is give Order and Quote in there Observer.

This event is occur for both frontend and backend.




and Observer code is

public function SyncWithInfusion(Varien_Event_Observer $observer)
        $order = $observer->getEvent()->getOrder();
    //get order
        $Quote = $observer->getEvent()->getQuote();


See at:custom checkout_submit_all_after observer not working

  • When checkout_submit_all_after will be called and how about using checkout_type_onepage_save_order_after ? I want the event that is called only when order is placed successfully.
    – Jordan
    Aug 21, 2014 at 4:18

To get the Increment Id from the order observer use:

$increment_id = $observer->getEvent()->getOrder()->getIncrementId();

To get the order id use:

$order_id = $observer->getEvent()->getOrder()->getId();
  • You didn't mentioned the event to be used here ?
    – Jordan
    Aug 20, 2014 at 12:52
  • Same as you were referring to <sales_order_place_after>
    – Eirik
    Aug 20, 2014 at 12:55

As you figured, you cannot get the ID before the order is saved. sales_order_place_after is dispatched before the order actually gets saved to the database (right before the transaction is committed). The very first event that is triggered after the transaction is submitted is sales_model_service_quote_submit_success.


In case of magento 2.*

create a events.xml for



  1. events.xml <?xml version="1.0" encoding="UTF-8"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/Event/etc/events.xsd"> <event name="{event_name}"> <observer name="{class name}" instance="{namespace of class}" /> </event> </config>

  2. observer code

    use \Magento\Framework\Event\ObserverInterface;

class Orderpush implements ObserverInterface {

protected $_class_scope_config;

public function __construct(
    \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
) {
    $this->_class_scope_config = $scopeConfig;
    // parent::__construct();

public function execute(\Magento\Framework\Event\Observer $observer)

$order = $observer->getOrder(); $order->getId();

} }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.