Your Dedicated Partner for All Things WordPress

Table of Contents

WooCommerce is a popular platform used for building e-commerce websites. It offers a great set of features that lets users create online stores with flexibility. One important feature in WooCommerce is creating unique order numbers. By default, WooCommerce generates sequential numbers for order IDs. However, in certain cases, users might want to customize or change order numbers. In this blog, we will discuss the ways on how to change order numbers in WooCommerce.

Method 1: Using Plugin to Change Order Number

One of the easiest ways to change order numbers in WooCommerce is to use a plugin. A plugin named Custom Order Numbers for WooCommerce plugin allows users to change the numbers in various formats. This plugin has several options. With ordinary sequential numbering, the users can choose their own starting number. You can configure the Sequential String option, where users can change the order number format like initials, random numbers, and more. With a Random Numbers option, the user can change the order number completely randomly on each order.

Urgent WordPress Assistance

Facing a critical WordPress issue? Don’t panic. Our Emergency Service is here to swiftly resolve any urgent website problems.

Method 2: Editing the Sequence in WooCommerce Database

Another way to change the order number in WooCommerce is by editing the sequence in the WooCommerce database. This method requires some technical knowledge to navigate the WordPress admin area. Start by taking a backup of your database before making any changes. Then open your PhpMyAdmin from your hosting control panel. Gen new MySQL query and enter the following command:

$table_name = $wpdb->prefix . ‘posts’;
$qry = $wpdb->query(“ALTER TABLE $table_name AUTO_INCREMENT = 1000000;”);

This command will start your order numbers starting from 1000000. You can change the number as per your preference. Make sure to replace $table_name with your database table name and run the query.

Method 3: Customizing the PHP code

This method needs some programming knowledge. This method involves editing the code in WooCommerce functions. You can customize the order numbers format, and start from your preferred number. Be cautious while editing the code and take a backup before making any changes.

Navigate to your WordPress dashboard > Appearance > Theme Editor > functions.php. Add the following code to the functions.php file:

add_filter( “woocommerce_sequence_number_settings”, “override_woocommerce_sequence_number_settings” );
function override_woocommerce_sequence_number_settings( $args ){
$args = ‘PD-‘;
$args = ”;
$args = 8;
$args = 10000;
return $args;

Method 4: Edit the Plugin File

This method may cause errors in future updates of WooCommerce. It’s advised to avoid editing plugin files unless you’re an experienced developer. For this method, navigate to WooCommerce > includes >admin >class-wc-admin-post-types.php. Search for the line starting with “$next_order_number”. This line sets the order ID for the next order. Replace the prefix to your preferred format, the suffix to your preferred format, and start with a preferred number.


In this blog post, we discussed several methods on how to change order numbers in WooCommerce. The most popular methods are using plugins to change the order numbers, editing the sequence in the WooCommerce database, customizing the PHP code, and editing the plugin file. Make sure to take a backup of your database or files before making any changes to avoid any errors or loss of data. Choose the method that suits you the best and start customizing your order numbers to enhance your online store experience.

Frequently asked questions

Can changing the order number in WooCommerce have any unintended consequences or impact on order processing?

Changing the order number in WooCommerce can potentially have unintended consequences. While it may seem straightforward, altering the order numbering system can affect the internal processes of your store. For instance, certain plugins or customizations may rely on the existing order numbering format, and changing it could cause conflicts or errors. It’s crucial to thoroughly test any changes and ensure that they don’t disrupt order processing or other essential functions of your store.

Are there any legal or regulatory considerations to keep in mind when altering order numbers, particularly in certain industries or regions?

In some industries or regions, there may be legal or regulatory requirements regarding order numbering. For example, industries with strict record-keeping regulations or jurisdictions with specific numbering conventions may have rules that dictate how order numbers should be formatted or maintained. Before altering order numbers, it’s essential to research any applicable laws or regulations and ensure that your changes comply with them to avoid potential legal issues.

Does changing the order number affect any existing records or reports within WooCommerce, such as order history or financial records?

Yes, changing the order number in WooCommerce can potentially affect existing records and reports within your store. Order numbers serve as unique identifiers for each transaction, and altering them may impact the accuracy and integrity of order history, financial records, and other reports generated by WooCommerce or third-party tools. It’s essential to consider the implications of changing order numbers on your store’s data integrity and take appropriate measures to mitigate any potential disruptions or discrepancies.

Are there any specific precautions or backup measures recommended before attempting to change the order number in WooCommerce?

Before attempting to change the order number in WooCommerce, it’s advisable to take several precautions and backup measures to minimize the risk of data loss or corruption. This includes creating a full backup of your WooCommerce database and files, as well as testing the changes in a staging or development environment before implementing them on your live site. Additionally, consider consulting with a developer or WooCommerce expert to ensure that the changes are implemented correctly and safely.

How can I ensure that changing the order number doesn’t cause conflicts with other plugins or customizations within my WooCommerce store?

Ensuring compatibility with other plugins or customizations within your WooCommerce store is crucial when changing the order number. Start by reviewing the documentation or support resources for any plugins or customizations that interact with order data or numbering systems. Additionally, consider testing the changes alongside these plugins or customizations in a controlled environment to identify and resolve any conflicts or issues before making them live. If necessary, reach out to the developers or support teams for assistance with ensuring compatibility and resolving any conflicts.

Instant WordPress Support

Get immediate assistance for your WordPress website with our on-demand support services.

Tailored WordPress Solutions

Elevate your online presence with our custom WordPress development services.

How to get started?

Learn more

WooCommerce Maintenance

Save 33% with our Annual pricing plan.

Get Started

Coupon Code Applied!

Take your time and continue browsing our services.

Alexey Seryapin
Founder of WPServices