1. Documentation /
  2. WooCommerce Sequential Order Numbers Pro

WooCommerce Sequential Order Numbers Pro

Overview

↑ Back to top
Sequential Order Numbers Pro is a WooCommerce extension that enhances the functionality of your WooCommerce site by allowing you to have incrementing order numbers rather than random ones. Additionally, you can set a starting number, order number length, custom prefix and/or suffix, and skip free orders, giving you full control over your shop’s order numbers.
As of WooCommerce 8.3, Cart and Checkout blocks are available as the default experience. WooCommerce Sequential Order Numbers Pro is now compatible with those blocks!

Features

↑ Back to top
  • Provides sequential order numbers rather than skipping values
  • Start the order numbering at any number (or for shops with existing order numbers, any number greater than your current largest order number)
  • Set a custom order number prefix or suffix
  • Include the current day, month, or year in your custom order number prefix or suffix
  • Include the current time: hour, minute, second in your custom order number prefix or suffix
  • Order number length can be set, automatically adding as many zeroes to the beginning of the order number as needed
  • Orders with only free products can be excluded from the paid order sequence for accounting purposes, and assigned their own custom prefix

Installation

↑ Back to top
  1. Download the extension from your WooCommerce dashboard
  2. Go to Plugins > Add New > Upload and select the ZIP file you just downloaded
  3. Click Install Now, and then Activate
  4. Go to WooCommerce > Settings > General, scroll down to “Order Numbers” and read the next section to learn how to setup and configure the plugin.

Setup and Configuration

↑ Back to top
No configuration is required for this plugin; in an empty site, orders will automatically be numbered beginning at 1, and with existing orders the numbering will pick up from the largest order number. Optional configuration settings to customize the order number can be found by going to WooCommerce > Settings > General:
WooCommerce sequential order numbers pro settings
Highly Configurable Custom Order Numbers
Order Number Start
This is the starting number for any newly placed orders. This can be used to start order numbering at an arbitrary point (ie 1000) as long as it is higher than the current largest order number, or can be used to advance the order number in a shop with existing orders. For instance, if the current highest order number is 24 and this is set to 500, the next orders placed will be: 500, 501, 502, etc.
You can also control the order number minimum length by including leading zeroes to pad your order numbers with at least that many zeroes and achieve a fixed length. For instance, setting the order number start to “00001” will result in the following order number sequence: 00001, 00002, 00003, etc.
Changing this setting does not affect existing orders!
Order Number Prefix
Allows you to set a custom order number prefix; this can contain any combination of characters, or patterns as described below. Setting this does not affect existing orders.
Order Number Suffix
Allows you to set a custom order number suffix; this can contain any combination of characters, or patterns as described below. Setting this does not affect existing orders.
Skip Free Orders
With this enabled, orders with only free products and no additional fees or costs will be excluded from the paid order sequence. Useful when required by certain accounting rules.
Free Order Identifier
This option is only available when the Skip Free Orders option is enabled. This allows you to set a prefix for the free orders numbering sequence so you can have for instance: FREE-1, FREE-2, FREE-3, etc.
For example, if the starting order number is set to 1000, Order Number Length is set to “5” by making the order number start “01000”, Order Number Prefix is set to “AA-” and Order Number Suffix is set to “-ZZ”, order numbering will be as follows: AA-01000-ZZ, AA-01001-ZZ, AA-01002-ZZ, etc.

Merchant Usage

↑ Back to top
There are two different scenarios to consider: activation in a site with existing orders, activation in site with no orders. When activated in a site with pre-existing orders, the existing order numbers will be unaffected, and order numbering for newly placed orders will directly follow the largest existing order number, or the configurable start number, whichever is bigger. When activated in a site with no orders, the first order number will be 1; this value can be configured as explained in the Configuration section above.

Prefix / Suffix Patterns

↑ Back to top
The following patterns can be used within the order number prefix/suffix fields to add special values to the custom order number. For instance, they allow you to have the current day, month, or year within your order numbers. Any number of patterns can be used, and in any order, and new patterns will continue to be added as they are requested.
{D}
Day of the month without leading zeros
{DD}
Day of the month, 2 digits with leading zeros
{M}
Numeric representation of a month, without leading zeros
{MM}
Numeric representation of a month, with leading zeros
{YY}
A two digit representation of a year
{YYYY}
A full numeric representation of a year, 4 digits
{H}
24-hour format of an hour without leading zeros
{HH}
24-hour format of an hour with leading zeros
{N}
Minutes with leading zeros
{S}
Seconds, with leading zeros
Example pattern usage of a custom order number prefix including the current date: WT-{YYYY}{MM}{DD}

Compatible Plugins

↑ Back to top
Compatible plugins will display the formatted sequential order number. For example, if my order number is WOO-1234-2015 in WooCommerce, Authorize.net AIM (a compatible plugin) will display this order number in my Authorize.net account as well. A compatible plugin can accept and use the formatted order number where relevant instead of the order ID. This list is by no means exhaustive, but lists some of the plugins that are known to be compatible with the Sequential Order Numbers plugin:
*Not when using Apple Pay

Other compatible plugins

Adding compatibility

Note that even if you don’t see your favorite plugin or gateway listed here, it doesn’t necessarily mean that the plugin isn’t compatible. Compatibility can be added to nearly any plugin or gateway – we advise getting in touch with the author of the plugin if it’s not compatible, and be sure to ask nicely!

Plugins That Do Not Support Sequential Numbers

↑ Back to top
This list is by no means exhaustive, but lists some of the gateways that are known, due to gateway limitations, to be unable to support sequential order numbers with the Sequential Order Numbers Pro plugin:
  • Apple Pay via Stripe
  • PayPal Payments Advanced
  • PayU
  • PayU Turkey
  • RedSys
This means that these gateways will always reference the order ID, and won’t use the formatted order number sent by Sequential Orders Numbers Pro, so your WooCommerce order number and gateway order number will not match up. For example, if my order number is WOO-1234-2015, an incompatible gateway will not show this, but will instead show the order ID (the non-sequential number), such as #1787.

For Developers

↑ Back to top

Getting Orders from Number

↑ Back to top
If you want to look up an order in WooCommerce, you can typically use:
wc_get_order( $order->id )
However, when Sequential Order Numbers Pro is in use, you may need to work backwards from the order number instead of the order ID. In this case, you can get the order ID easily by using:
$order_id = wc_seq_order_number_pro()->find_order_by_order_number( $order_number );
This will return the correct order ID from the order number. You can then use the order ID to get order information as needed.

Performance Mode

↑ Back to top
Version 1.7.0 of this plugin added a “performance mode” for shops with an extremely large number of orders. Please note: If enabled, a better performing (but potentially less accurate) means is used to generate the order number sequence. This is useful for shops with huge databases (i.e., over 100,000 orders) that receive several orders each second (i.e., more than 10 orders per second), and have experienced negative performance issues while generating orders. These metrics will vary based on your site’s hosting environment, and performance mode isn’t needed for most large shops. The main potential drawback to having performance mode enabled is that, when deleting the most recent order, that order number will not be automatically re-used. This can be be a positive or negative depending on your country’s accounting laws. You should only enable this if you know what you’re doing. If you’re not sure that performance mode is a good fit for your shop, please get in touch via the help desk with any questions. Performance mode can be enabled via filter:
add_filter( 'wc_sequential_order_numbers_performance_mode', '__return_true' );

Frequently Asked Questions

↑ Back to top
Q: I tried setting the starting order number but it’s not being used. What’s the problem? A: If you’re operating in an environment with existing orders you must use a starting number which is greater than the biggest existing order number. This is done so that historical order numbers are not altered.
Q: I’ve updated from the free version to this paid version but my order numbers aren’t saving right. A: Please ensure that you only have Sequential Order Numbers Pro active. Having both plugins active can cause a conflict that will result in your order numbers not respecting your settings.
Q: This is supposed to be compatible with the Order CSV Import Suite, but my Sequential Order Numbers are not showing. How do I fix this? A: You’ll need to set both the order_number and order_number_formatted as described in our CSV Import Docs, as the “order_number” corresponds to the order id.
Q: This plugin works great, but the order numbers aren’t being used by plugin ___________, what gives? A: Third-party plugins can generally easily be made compatible with the Sequential Order Number Pro plugin. Get in touch with the particular plugin author and see if they would be willing to upgrade their plugin. Also verify that your gateway isn’t one of the few on the short list of gateways which due to technical limitations can not be made compatible.
Q: I’m a plugin author and I want to make my plugin compatible with WooCommerce custom order numbers so it will support the Sequential Order Numbers plugin, as well as any other plugin that modifies order numbers. How do I go about this? A: For most plugins this is an easy process, simply replace the post-id order number (ie $order->id) with $order->get_order_number() anywhere that the order number is displayed. When sending the order number to outside systems, such as payment gateways, you may want to use something like the following: ltrim( $order->get_order_number(), __( '#', 'hash before order number', your-plugin-text-domain ) ) where the ltrim is used to cut off the leading hash that would otherwise be included (prior to WooCommerce 2.3). Orders are still looked up and handled internally by the underlying post id, so these changes are made only for display purposes. Generally the only time that adding support gets tricky is with redirect-based payment gateways, since you need to pass both the underlying post_id, for looking up the order on the post-back, as well as the get_order_number() value for displaying within the gateway order manager. Some gateways like CyberSource make it easy to pass custom fields, others like Braintree require the customer to register the custom field, and with still others it’s not even possible.
Q: Why does the URL refer to the Order ID and not the Sequential Order Number? A: The order ID in the URL is used to retrieve the correct order from the database and, while it is possible that other information could be used, it would require modification of WooCommerce core. It is not possible to use the number generated by Sequential Order Numbers Pro as there are too many possible order number variations that are not compatible with URL parameters – the hash for example.

Questions & Support

↑ Back to top
Have a question before you buy? Please fill out this pre-sales form. Already purchased and need some assistance? Get in touch with support via the help desk.