In Magento, defining an appropriate Order Status provides a clear idea for the operations team to understand the position of the order and take the necessary action. Magento has an Order State and Order Status that describes the current position of the order. The Default Order State and the corresponding statuses available in Magento are:

Order StateOrder Status
NewProcessing
Pending PaymentPending Payment
ProcessingSuspected Fraud
CompletePayment Review
ClosedPending
CanceledOn Hold
On HoldComplete
Payment ReviewClosed
Canceled
Pending PayPal

Each Order State can be associated with different kinds of Order Statuses to provide a clear picture about the order. While Magento provides an option to customize the Order Status, the Order State still has the default options. In few occasions, retailers look out for a customized Order State so that there is no miscommunication across different verticals in the organization.

We are planning to add a new Order State called “Partially paid”.  Let’s have a look at the method to create a customized Order State in Magento.

Step-1:

First we need register the new module in Magento. To accomplish this, create a new xml file in this path.  app/etc/modules/Custom_Orderstate.xml

Step-2:

Next, we need to configure our module. The configuration files can be found in the “etc” folder inside our module directory. So let’s create the configuration xml file: app/code/local/Custom/Orderstate/etc/config.xml

Step-3:

Once the configuration is done, we need to create a SQL script file to insert our order state on the database tables (sales_order_status & sales_order_status_state).  Let’s create a new PHP file in the following folder:
app/code/local/Custom/Orderstate/sql/orderstate_setup/mysql4-install-0.1.0.php

Step-4:

The final step is to login your Magento admin side. You can see the newly created order state ‘Partial Paid’ under the System > Order Statuses path.

Magento Order State

With changing market dynamic retailers, look out for methods to improve the operational efficiency by providing an appropriate order state.  This will allow a clear flow of communication across different departments in the organization enabling retailers to avoid confusions and increase productivity.

Be the first to Know

Subscribe to our blog to get the latest articles directly to your inbox.

READY TO DRIVE SALES?

Ready to drive online revenue

Get In Touch

13 thoughts on “How To Create A Custom Order State In Magento?

  1. I tried the code above to the tee. It’s showing under system/order statuses but not showing as an option to change the status of an order.

  2. I tested the code first with one state only and it worked but when added 2 more states, its not working.

    I followed every step, also the code given in comment but nothing is working!!

    Any suggestion please

    1. Hi Rafael,

      Thanks for your comments.
      Please subscribe to our blogs for more insights on eCommerce,Magento & QA.

  3. Hi, very nice tutorial! A question: how can I have the new custom state assigned to a particular process.. example: I need that when a credit memo is created for an order, the order does not go into complete state but goes into custom state. How do I achieve that?

    1. Hi Lounik,
      Thanks for your mail.
      By using the above code, we can only create the new order state. For assigning that state to a particular process, we have to customaize the default code.
      Let us know if you have any further queries.
      Please subscribe to our blogs.
      Thanks.

  4. awsom tutorial, but a kind request it would be better if you write the complete code like $installer->startSetup(); .It will help to new beginners.

    1. Hi PK,

      Sorry for the late reply.

      Here is the code…please test it before you implement the same.
      Thanks.
      Please subscribe to our blogs. Mail us if you have any queries.

      In the app/code/local/Custom/Orderstate/etc/config.xml file, add your state lists like follows,

      Partial Paid

      Partial Paid New State

      Partial Paid

      Partial Paid New State

      In the app/code/local/Custom/Orderstate/sql/orderstate_setup/mysql4-install-0.1.0.php file, add your state lists like follows,

      // Insert statuses
      $installer->getConnection()->insertArray(
      $statusTable,
      array(‘status’, ‘label’),
      array(
      array(
      ‘status’ => ‘partial_paid’,
      ‘label’ => ‘Partial Paid’
      ),
      array(
      ‘status’ => ‘partial_paid_new’,
      ‘label’ => ‘Partial Paid New State’
      )
      )
      );

      // Insert states and mapping of statuses to states
      $installer->getConnection()->insertArray(
      $statusStateTable,
      array(‘status’, ‘state’, ‘is_default’),
      array(
      array(
      ‘status’ => ‘partial_paid’,
      ‘state’ => ‘partial_paid’,
      ‘is_default’ => 1
      ),
      array(
      ‘status’ => ‘partial_paid_new’,
      ‘state’ => ‘partial_paid_new’,
      ‘is_default’ => 1
      )
      )
      );

  5. Yeah!
    The only guide that explains exactly which files to create, in what path and how to set the config properly.
    The other guides put only portions of code without saying where and how they must to be written!
    Thanks so much!!!

Leave a Reply

Your email address will not be published. Required fields are marked *