how incrementId generated, how it relates to orderId

what is the best scenario to use both and why?

  • Welcome to Magento SE. "loadByIncrementId()" is a method, so the question is not quite clear. But I assume with "loadByIncrementId" you actually mean the increment_id attribute of orders and with orderId the id / entity_id attribute? In that case, see my anser. Otherwise, please update the question with more explanation what you are refering to. Jun 21, 2016 at 7:10
  • i got it, question edited
    – user41201
    Jun 21, 2016 at 7:39

1 Answer 1


loadByIncrementId() is a method that loads an order, given an "increment id".

This is the human friendly order number that is displayed to the customer (like "100000001") and is generated based on certain rules (default: store id + 0-padding + consecutive number)

The "order id" on the other hand is the internal primary key (auto increment) of the sales_flat_order database and is used in database and code to uniquely identify orders.

Your Answer

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