Ordernumbers for WooCommerce

IMPORTANT ANNOUNCEMENT: Plugin development ceased, all plugins made available freely (GPL)

With great sadness we have to announce that we are ceasing development of all our VirtueMart, WooCommerce and Joomla plugins. Effective immediately, all our plugins -- even those that were paid downloads -- are made available for free from our homepage (GPL license still applies), but we cannot and will not provide any support anymore.

It has been a great pleasure to be part of the thriving development communities of VirtueMart as well as WooCommerce. However, during the last year it became painstakingly clear that in addition to a full-time job, a young family and several other time-consuming hobbies at professional level (like being a professional singer) the plugin development and the support that it requires is not sustainable and is taking its toll. It has been an honor, but it is now time to say good bye!



The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1


Two orders with same order number 01 Dec 2015 12:24 #1

  • andreas
  • andreas's Avatar Topic Author

One of our clients experienced a problem during this weekend when running a sale. Two orders that came on at the same point has the same order number (we can't see seconds but hour and minute match). Our guess is they were written to the db at the same time. Post ID is not the same.

So my questions are:

1. How can we change the order number in the DB?
2. How can we take action prevent this from happening again? Our store has a lot of visit and we see the possibility of two people ordering at the same time happening again. Maybe you need to update something in your plugin (post id check before assigning order number?).
3. Is your plugin compatible with WooCommerce 2.4.10?

We are running the Pro version.



Two orders with same order number 11 Dec 2015 23:06 #2

Dear Andy,
Thanks for the report.

We have been able to reproduce the bug: If a second order is submitted while another order is still processed (i.e. the two orders are practically submitted at the same time), WooCommerce / Wordpress apparently does NOT reload the configuration when the first order changes the global counter. In particular, if the first order increases the counter and afterwards the second order requests the current counter value, Wordpress still returns the old value before the first order increased the counters. Thus the duplicate numbers.
We are working on a fix for this issue. Probably the most efficient/straightforward way would be to force WordPress to reload its configuration immediately before reading out the current value of the counter (and increasing it immediately afterwards). However, this might have unexpected side-effects (inconsistent config values), too, so we have to properly test first.

As soon as we have a fix, we'll let you know.

As to the other questions:
1. The order number is stored as postmeta '_oton_number_ordernumber' for the corresponding order post
3. Yes, the plugin is compatible with WC 2.4.10.

Best regards,

Two orders with same order number 13 Dec 2015 20:13 #3

Dear Andy,
We have now released version 1.2 of the plugin, which should fix your issue. As indicated in my previous message, the fix is that the options cache is deleted whenever a counter is read using get_option. Plus, we now make sure that the counters are never auto-loaded (also for performance reasons on all other pages). Both together (or even each on its own) should make sure that no duplicate number will be generate any more.

Best regards,

Two orders with same order number 14 Dec 2015 00:18 #4

  • andreas
  • andreas's Avatar Topic Author
Thanks Reinhold for following up on this issue with a detailed answer and update of the plugin. Your plugin a great addition to WooCommerce so I'm happy to see it's supported.

Will try the out the new version tomorrow!
  • Page:
  • 1