In our Magento 2 store suddenly order id has started skipping order id by 1.
Here is the order id example:
000000011
000000013
000000015
000000017
000000019
I went through multiple posts like magento-order-number-issue and magento-order-id-increment-jumps, and they say like due to failed/in-complete payment, or customer doesn't complete all checkout steps this issue might occur.
So my question is, it should happen only in the mentioned scenarios and from next order it should work fine if there isn't any issue, but in my case it always skips 1 order. I have observed this for around 100 orders.
Few posts also suggest due to abandoned cart this issue might occur so I have truncated quote tables using below query, still issue exists.
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE TABLE `quote`;
TRUNCATE TABLE `quote_address`;
TRUNCATE TABLE `quote_address_item`;
TRUNCATE TABLE `quote_id_mask`;
TRUNCATE TABLE `quote_item`;
TRUNCATE TABLE `quote_item_option`;
TRUNCATE TABLE `quote_payment`;
TRUNCATE TABLE `quote_shipping_rate`;
SET FOREIGN_KEY_CHECKS=1;
How I can fix this?
reserveOrderId
whithout checking if the quote has already a reserved order id. Try disabling all custom extensions and see if it happens.setReservedOrderId($reservedOrderId)
that might guide you to the right point. If you have the possibility, I would suggest to create a plugin and hook it before that method to log all the calls with backtrace, that might give you a hint where the calls come from