Change Magento Order ID/Invoice Number in PHPMyAdmin

Change Magento Order ID/Invoice Number in PHPMyAdmin

October 12, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Change Magento Order ID/Invoice Number in PHPMyAdmin

Changing Magento Order ID/Invoice Number using PHPMyAdmin

If you’re new to the world of e-commerce development, changing order IDs or invoice numbers in Magento can seem like an intimidating task. But don’t worry - with these detailed instructions and a bit of patience, you’ll be able to make those changes without any issues.

Understand the Magento Database Structure

Before diving into the code, it’s essential to understand that Magento uses MySQL as its database management system. The main tables relevant for order management are:

  • sales_flat_order: Stores general information about each order.
  • sales_flat_invoice: Contains invoice-specific data for each order.

Changing the Next Order ID

Let’s say you want to change the next automatic order number from 100XXX to something else. Here’s how you can do it:

Step 1: Access PHPMyAdmin

First, log in to your PHPMyAdmin account using the credentials provided by your hosting provider.

Step 2: Navigate to the Core Config Data Table

In the left-hand menu, look for the core_config_data table and click on it. This table stores all of Magento’s configuration settings.

Step 3: Find the Order Increment ID Setting

Search for the row where the path field contains sales/increment_prefix. The value in this field is currently set to ‘100’ (or whatever your current prefix is).

Step 4: Change the Increment ID

Click on the edit button next to the appropriate row. Change the value in the value field to the new prefix you want, and click the “Go” button.

For example, if you want your next order number to start with ‘200’, simply replace ‘100’ with ‘200’.

Changing Individual Order or Invoice Numbers

If you need to change an existing order ID or invoice number, follow these steps:

Step 1: Locate the Relevant Table

For orders, go to sales_flat_order. For invoices, go to sales_flat_invoice.

Step 2: Find the Order/Invoice Record

Search for the record with the current order/invoice ID you want to change.

Step 3: Make the Change

Click on the edit button next to the appropriate row. Update the increment_id field (for orders) or the invoice_number field (for invoices).

For example:

UPDATE sales_flat_order SET increment_id = '20002' WHERE entity_id = 1;

Step 4: Save Your Changes

Click on the “Go” button to save your changes.

Best Practices and Warnings

  • Always backup your database before making any changes.
  • Be extremely careful when editing core Magento tables, as incorrect changes can break your site’s functionality.
  • If you’re unsure about any operation, consult a Magento developer or seek help from an official support channel like the Laravel Company forums.

Conclusion

Changing order IDs and invoice numbers in Magento might seem complex at first, but with this guide, you should now be able to make these changes without any issues. Just remember to always backup your database before making any direct modifications.

If you found this tutorial helpful, consider checking out our blog for more tips on Magento development here. Don’t forget that if you ever need professional help with your Magento store, our team of experienced developers is always ready to assist you.

Database Admin Configuration Orders

Our network