Does anyone know how the Order number increases in Drupal Commerce?

Obviously when someone puts in a new order the order number will be AT LEAST one larger than the previous order number, but other than that why would the order number increase?

For example while testing the site my first order # is 1 (duh), but then 19 days later when I tested it the order # was 19, without any other tests occurring in the interim. The following day I did a test transaction and the order # became 31.

It keeps going up every time I test it but it doesn't just increment by one every time. So I'm just curious why it might be behaving this way. Anyone know?


Orders are created as soon as a customer submits an Add to Cart form. There isn't a separate intermediate cart object in Drupal Commerce - from the first chance we use a full order object in the Shopping cart order status. You can see a list of cart orders from the Shopping carts tab on the order admin listing. Note that it will also show and orders that have not completely cleared the checkout process as well.

| improve this answer | |
  • 1
    Yes, thank you. I discovered this to be true. Since I'm skipping the 'add to cart' process via rules and just having users go right to the form for their information, it's auto-incrementing the order by 1...but then of course people don't necessarily fill out or purchase the item just because they went to the page. – Sage Apr 26 '16 at 18:59

If you are certain there are no other users that have access to the order process, it might be caused by abandoned carts or failing payments.

Best is to have a look at example.com/admin/commerce/orders. It should give you a full list of all orders and the states they are in. Like I said if these were abandoned carts or half completed payments, orders might remain in a certain state, in which they are invisible in some other UI pages.

To answer your question. The Drupal Commerce order id is an auto increment field just as any other ID in Drupal, and it should increase with your auto increment value (mostly 1, though I sometimes have heard 5 as well).

| improve this answer | |
  • That's interesting. When I go to the page you're referring to (that's where I was looking before). It shows order 552, 580, 587, 590, 593 (in that order). Nothing in-between. We also got an order placed to PayPal (paid for) that's not even showing on this orders page. All the orders on this page show as 'pending' although the payments were made successfully to PayPal. What might be going on? – Sage Apr 25 '16 at 0:29
  • Since my form is a one-page form (no 'add to cart' no 'next' button - just fill out and pay) perhaps users are going to the page (and it's generating an order number automatically) but they are deciding not to submit payment. what do you think of that theory? – Sage Apr 25 '16 at 0:32
  • ... (to add to @Sage's comment above), and Commerce module deleted old orders that did not went through. – AyeshK Apr 25 '16 at 4:11
  • The pending status might be caused by your payment module. In some cases the payment cannot be verified immediately and some payment modules use cron to check the payment again later. (But that depends on what you are using). It is also very possible they fill in the form and when they are redirected to paypal, they leave. It is a perfect explanation for what is happening and it is up to you to figure if this really happens. @AyeshK That could also be the payment module that failed to verify the payment, but again that depends on the setup. Hope this gets you somewhere. – Neograph734 Apr 25 '16 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.