WooCommerce does not create invoices or invoice numbers: that is always done by a plugin. When numbers repeat or skip, the cause is almost always one of three things: the plugin prints the order number (which has gaps by design), two processes took the same number at the same moment, or the plugin’s counter was moved back by a settings change, a database copy or a yearly reset. You fix it by finding which one, setting the counter right and correcting the bad invoices with a credit note instead of editing them.

Why it happens

  • The “invoice number” is really the order number. Many invoice plugins can print the order number instead of their own sequence. Order numbers in WooCommerce are database IDs, and drafts, failed payments and deleted orders all use one up. Result: gaps.
  • Two processes number the same order at once. A payment gateway that confirms the order twice (for example, PayPal Standard with both IPN and PDT turned on), a bulk status change, or an automatic email and a manual “create PDF” at the same second. If the plugin reads the counter and then saves it in two separate steps, both get the same number.
  • The counter went backwards. Someone set “next invoice number” lower than the last invoice issued, or a staging copy of the database was pushed to the live shop (or the other way round) and brought an old counter with it.
  • Yearly reset and old orders. You create invoices in January for orders from December. Some plugins number them with the new year, or restart at 1 and repeat numbers. In one WordPress.org thread, every invoice for last year’s orders came out as “2021/0001” until the plugin was updated.
  • The number is assigned on a status change. Some plugins give the number when the order becomes “Completed”. If you mark a batch of old orders as completed later, they get new numbers in the new year, and the customer may receive an email with the changed invoice.
  • Settings not saved. A small one, but it happens: in one thread the starting number “didn’t work” because the user clicked “Apply” but never saved the settings page.

How to check it yourself

  1. Find out which plugin makes your invoices. Go to Plugins > Installed Plugins and look for “invoice” or “PDF”. If you have two invoice plugins active, that alone can explain duplicates: turn one off.

  2. Check what the plugin prints. In its settings, look for an option like “Display invoice number” or “Number source”. If it says “order number”, your gaps are normal order ID gaps, not a broken counter.

  3. List your invoice numbers. Most plugins add an invoice column to WooCommerce > Orders or have an export. Export the last few months to a spreadsheet, sort by invoice number and look for repeats and jumps.

  4. Or ask the database. If you can use phpMyAdmin, this finds repeated numbers. The meta key _wcpdf_invoice_number is the one used by PDF Invoices & Packing Slips for WooCommerce; other plugins use a different key, so check their documentation. With High-Performance Order Storage (HPOS) the table is wp_wc_orders_meta; with classic storage it is wp_postmeta (and change wp_ if your prefix is different).

    SELECT meta_value AS invoice_number, COUNT(*) AS times
    FROM wp_wc_orders_meta
    WHERE meta_key = '_wcpdf_invoice_number'
    GROUP BY meta_value
    HAVING times > 1;
  5. Read the order notes of a duplicated pair. Open both orders. If one shows “Payment complete” twice, or two status changes a second apart, you have a double confirmation from the gateway.

  6. Compare the counter with reality. Look at the “next invoice number” in the plugin settings. It must be exactly the last issued number plus one.

How to fix it

  1. Stop the cause first. Turn off the second invoice plugin if there is one. If PayPal confirms twice, keep only one method (IPN or PDT). Avoid bulk-changing statuses on many orders while the plugin creates invoices on that status.
  2. Use a real invoice sequence. Switch the plugin from “order number” to its own invoice number. From that point numbers are consecutive; the old invoices keep their numbers.
  3. Set the counter right. Put “next invoice number” at the highest number already issued plus one. Never lower: a lower number will repeat invoices you already sent. Save the settings page and create one test invoice to confirm.
  4. Do not edit or delete invoices you already sent. An invoice the customer has received is a legal document in most countries. For a duplicate, keep the first one, cancel the second with a credit note that cites it, and issue a new invoice with the next free number. Most invoice plugins can do credit notes; if yours can’t, do it in your accounting software.
  5. For gaps, write down which numbers are missing and why (a deleted test invoice, a failed save). Your accountant will tell you if your country needs anything more. Don’t fill gaps by backdating new invoices.
  6. For old orders after the new year, turn off the yearly reset, set the next number to last year’s last number plus one, create the old invoices, then set it back to this year’s next number and turn the reset on again. This is the workaround the PDF Invoices & Packing Slips team gave in the thread above. Update the plugin first: some versions had bugs with exactly this.
  7. Never copy a staging database over the live shop without excluding orders and the invoice counter.

How to stop it happening again

If you don’t want to watch the counter by hand, our plugin InvoiceCraft takes each number with an atomic database operation and a unique key, so two orders paid in the same second can’t get the same number, and a failed save doesn’t leave a gap. You choose the format (prefix, year, month, digits, suffix), the yearly or monthly reset runs in your site’s time zone, and you can set the next number to continue from your old plugin. Each invoice keeps a snapshot of its data and is chained to the previous one with a hash, and “Check the issued invoices” tells you if something was changed or deleted in the database. Refunds create their own credit notes. It won’t repair duplicates your previous plugin already made: those you fix as described above. It costs 35 USD a year for one site, and you can try it in the demo.

Frequently asked questions

Does WooCommerce number invoices by itself? No. WooCommerce has order numbers, not invoices. Invoice numbers always come from a plugin or from your accounting software.

Why are my invoice numbers the same as my order numbers, with gaps? Your invoice plugin is set to print the order number. Order IDs skip numbers because drafts, failed payments and deleted orders use them up. Switch the plugin to its own invoice sequence.

Can I just change the number of a duplicate invoice? Not if the customer already has it. Cancel it with a credit note and issue a new invoice with the next number. If nobody has seen it yet, ask your accountant whether you can delete it.

What should “next invoice number” be? The highest invoice number already issued, plus one. Setting it lower will repeat numbers; setting it higher leaves a gap.

Do I need separate numbers for credit notes? In many countries, yes: credit notes usually go in their own series. Check with your accountant.