Introduction
In the world of e-commerce, order numbers are more than just database records; they are a key part of customer service, accounting, and professional branding.
A store that launches with "Order #1" may inadvertently signal to customers that it is brand new and untested. Conversely, starting at "#1000" or "#2025-001" projects longevity and stability.
Drupal Commerce, one of the most flexible e-commerce frameworks available, distinguishes between two key concepts:
- Order ID: The internal, sequential database integer (primary key).
- Order Number: The customer-facing string that appears on invoices and emails.
By default, these two are identical. However, depending on your version of Drupal Commerce, changing them requires different approaches.
Setup:
Web server running on Ubuntu 18.04, 20.04, 22.04, LAMP stack
Drupal 8,9,10,11
Installed Drush, Composer
Drupal Commerce 2, dependent modules
Scenario A: Drupal 8, 9, 10+ (Commerce 2.x)
In modern versions of Drupal Commerce (2.x), the "Number Pattern" system is built directly into the core architecture. This allows you to change how order numbers are generated without touching the database or writing code.
Path to configure a Number Pattern (Drupal Commerce 2)
/admin/commerce/config/number-patterns/order_default/edit
Step 1: Configure a Number Pattern
- Navigate to Commerce > Configuration > Orders > Number patterns.
- You will likely see a "Default" pattern. Click Edit.
- Here you can customize the generation logic.
Type: Choose "Infinite" (sequential) or "Yearly/Monthly" (resets periodically).
Initial number: This is the field you are looking for. Change this from 1 to 1000 (or your desired starting number).
Padding: Set this to 6 if you want order numbers to look like 001000. - Save the configuration.
Step 2: Assign the Pattern to an Order Type
If the number doesn't change immediately, ensure the pattern is assigned to your order type.
- Navigate to Commerce > Configuration > Orders > Order types.
- Edit your order type (usually named "Default").
- Look for the Number pattern dropdown and ensure your configured pattern is selected.
- Save.
Note: This only changes the Order Number (customer-facing). The internal Order ID will still be a low integer (e.g., 1, 2, 3).
Scenario B: Drupal 7, 8, 9, 10+ (Commerce 2.x)
Another the most common way to change the starting number is to alter the database directly so the internal auto-increment counter starts higher.
You need to alter the AUTO_INCREMENT value of the commerce_order table. You can do this via a tool like phpMyAdmin or the command line.
SQL (MySQL)
Run the AUTO_INCREMENT command in SQL to set the new starting increment number.
(Replace 1000 with your desired starting number).
Summary
Changing the starting order number helps established businesses maintain professionalism and continuity.
For Modern Drupal (8+): Use the Number Patterns configuration in the Commerce menu. It is safe, upgrade-proof, and flexible.
As an alternative: Use the ALTER TABLE SQL command to bump the auto-increment ID, or use contributed modules to format the number string.