I want to add some prefix to order number.

Our website has 6 stores and i wanna classify which store customer purchase the item.

You know, orders in ebay and amazon already have their own prefix to order number like this

enter image description here

But orders proceeded in our own website do not have the prefix, just store_id + number

How can i add some text prefix to order number? I think by using store_id, i can add them but i don't know how to do. Thank you.

1 Answer 1


Add following code in config.xml created in Namespace/Custom/etc folder.

Make sure I have created Namespace_Custom


Create file in Model directory named Observer.php

class Namespace_Custom_Model_Observer extends Varien_Event_Observer {
    public function customMethod( $observer) {
        $order = $observer->getEvent()->getOrder();        
        $store_id = Mage::app()->getStore()->getStoreId();
        $prefix = 'PREFIX-';
        $reservedOrderId = Mage::getSingleton('eav/config')->getEntityType('order')->fetchNewIncrementId($store_id);
        if ($reservedOrderId != '') {
            $order->setIncrementId( $reservedOrderId);


I hope you will clear the cache and session. then check it.


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.