For an order, when an invoice is created the order status changes to processing. Now, if a shipment is created the order status changes to Complete.

On debugging the code.. I have been able to find out the place where shipment save occurs.

Below is the file path: app\code\core\Mage\Adminhtml\controllers\Sales\Order\ShipmentController.php

In the following function:

 protected function _saveShipment($shipment)
        $transactionSave = Mage::getModel('core/resource_transaction')
         return $this;

I tried debugging the shipment variable data, but the status values show up as processing. But after the _saveShipment function is executed the order status changes to Complete

Could anyone tell me at what point the order status changes to Complete.

  • Did you get any solution? Commented Aug 26, 2016 at 9:05
  • Hello, The status of the Order changes when there is Shipment and Invoice. Even if you create a Shipment and then create an Invoice status will be changed to Complete. Because the Code for the Status is not available under the Shipment or Invoice classes but under the Magento Order classes. Commented Jan 15, 2022 at 16:14

1 Answer 1


I found the code in


Look for statement

$this->_setState(self::STATE_COMPLETE, true, '', $userNotification);

in below function

protected function _checkState()
        if (!$this->getId()) {
            return $this;

        $userNotification = $this->hasCustomerNoteNotify() ? $this->getCustomerNoteNotify() : null;

        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);
        return $this;

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.