Your Dedicated Partner for All Things WordPress

Ways to Change the Order Number in WooCommerce

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.

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.

How to get started?

Learn more

WooCommerce Maintenance

Save 33% with our Annual pricing plan.

Get Started

Looking for help? Chat with us.

Are you in need of assistance or guidance? Look no further! Our dedicated team is here and ready to help. Chat with us today and let’s work together to find the perfect solution for your needs.

Our support team will get you:

I believe every website owner deserves a reliable professional support always by their side.

Alexey Seryapin
Founder of WPServices

Coupon Code Applied!

Take your time and continue browsing our services.

Alexey Seryapin
Founder of WPServices