Confusion with order id, order increment id and I am not getting order id as 20001201

  • I am bit confused with order id and order increment id, So can any one help me to understand the difference between these two?

    I have an observer for sales_order_place_after where I store sales details in a custom table.

    But with

    $orderId = $observer->getEvent()->getOrder()->getId();

    I get the order ids as normal ids like 112 or 113 or 110 etc not like 20001201

    So which is the real order id, 20001201 or 112?

    I need to further process order data based on this order id, I use 112, 113 etc. and it works, but I need to clarify this.

  • mpaepper

    mpaepper Correct answer

    7 years ago

    The difference is:

    • order_id is the internal Magento order ID
    • order increment ID is the ID which you communicate to your customer

    You can easily load an order using the internal order_id:


    PS: If you need it, you can easily get the increment ID from a loaded order:


    You mean Developer use internal Id and clients and other use Increment_id?

    Charlie, Marius' post below differentiates between the two, and mpaepper's response actually shows the method that is called on an order to return the Increment ID (which is effectively the 'Order ID' in the admin view and in to the customer).

License under CC-BY-SA with attribution

Content dated before 7/24/2021 11:53 AM