When a user first places an order the state will be 'new' which I understand makes the order non visible.

Given this state we can assign statuses like 'new' and 'pending' which I believe makes the order visible.


If the order's payment method is set to 'auth & capture' or if either 'invoice' or 'ship' is completed for an order but not both then the state will be 'processing`.

For such orders, statuses can be 'shipped' or 'invoiced'.


If both are completed then the state will be completed as will the status.

So my doubt is how magento understand particular state is new or processing or completed ?

is there any event-observer functionality for this?

I mean if user clicks place order button any observer will trigger?

Is there any definition for each state?

  • What is your magento version? In early versions there was a XML configuration, not the states are in the DB.
    – Amasty
    Commented Jul 29, 2014 at 15:55
  • magento 1.9 version
    – sivakumar
    Commented Jul 30, 2014 at 11:02

1 Answer 1


This happens in the model sales/order (so Mage_Sales_Model_Order). It has a _beforeSave() method which calls a method called _checkState(). Inside that _checkState() method (only part of it):

if (!$this->isCanceled()
    && !$this->canUnhold()
    && !$this->canInvoice()
    && !$this->canShip()) {
    if (0 == $this->getBaseGrandTotal() || $this->canCreditmemo()) {
        if ($this->getState() !== self::STATE_COMPLETE) {
            $this->_setState(self::STATE_COMPLETE, true, '', $userNotification);
     * Order can be closed just in case when we have refunded amount.
     * In case of "0" grand total order checking ForcedCanCreditmemo flag
    elseif (floatval($this->getTotalRefunded()) || (!$this->getTotalRefunded()
        && $this->hasForcedCanCreditmemo())
    ) {
        if ($this->getState() !== self::STATE_CLOSED) {
            $this->_setState(self::STATE_CLOSED, true, '', $userNotification);

if ($this->getState() == self::STATE_NEW && $this->getIsInProcess()) {
    $this->setState(self::STATE_PROCESSING, true, '', $userNotification);

So depending on your state of the order, e.g. see the last two lines if the state was new and the order has getIsInProcess() (which basically checks for invoices / shipmments), then the state will be changed to processing.

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.