How do I set/reset the starting order number for my store?

Orders are numbered sequentially, starting at number "1" for a new installation of Ubercart. After testing your new installation you will probably want to reset the first order number to a different value - to pick up where your old e-commerce system left off, for example, or simply because single-digit order numbers give the wrong (or right?) impression to your customers.

Ubercart stores order numbers in the database, so to change the order number you have to make a change to the database. The needed change depends on which version of Ubercart and Drupal you're using. In all cases, be sure to take your site off-line before you modify the database - you don't want to interfere with an order in progress! Furthermore, you should be aware that a maximum order number of 8388607 exists because of the data type used for the database column. Be sure to leave plenty of room for the orders to start rolling in.

Ubercart 3.x on Drupal 7
The current order number is stored in the database in an autoincrement database field. You can use a tool like phpMyAdmin to alter the value stored in this row, or you can execute the following SQL. In this example, we will set the new starting order number to "1234":

ALTER TABLE uc_orders auto_increment = 1233;

Note that the next order placed will be one greater than the number stored in this table, so if we want to start at "1234" we set the column to be "1233". Your new starting order number must be higher than any existing order numbers!

Ubercart 2.x on Drupal 6
The procedure for Ubercart 2.x on Drupal 6 is the same as the above instructions for Ubercart 3.x on Drupal 7.

Ubercart 1.x on Drupal 5
If you're using MySQL as your database, the current order number is stored in a table called sequences in a row named uc_orders_order_id. You can use a tool like phpMyAdmin to alter the value stored in this row, or you can execute the following SQL. In this example, we will set the new starting order number to "1234":

UPDATE sequences SET id = 1233 WHERE name = 'uc_orders_order_id';

Note that the next order placed will be one greater than the number stored in this table, so if we want to start at "1234" we set the column to be "1233".

Your new starting order number must be higher than any existing order numbers! If there is no row for this variable, it is recommended you create a test order so the order ID row gets set, then adjust it as described above.

If you're using PostgreSQL, the procedure is different. The order number is stored in a sequence called uc_orders_order_id_seq. To change the sequence value you need to use the following statement. Again, using "1234" as our desired starting order number:

SELECT setval('uc_orders_order_id_seq', 1233);

This will update the uc_orders_order_id_seq sequence, and the numbering of new orders will start with the number following the one given as the second parameter.