WooCommerce Invoicing

Fix WooCommerce Invoice Numbering: Sequential Gaps, Sync Errors & Compliance

Your invoice numbers have gaps. Your accountant is asking questions. Some countries will fine you for it. Here is exactly what causes it, how each plugin handles it, and how to reconcile the mess if it is already too late.

Extract Invoice Data — Free Demo Developer API — £29/mo

Why WooCommerce Invoice Numbers Have Gaps

WooCommerce does not have its own invoice numbering system. Out of the box, it uses WordPress post IDs as order numbers. These post IDs are shared across every post type in your WordPress database — pages, media uploads, revisions, menu items, custom post types. Every time WordPress creates any of these objects, it consumes the next available ID.

So if order #1047 is followed by order #1052, the "missing" numbers 1048–1051 were used by a draft blog post, two image uploads, and an auto-save revision. WooCommerce did not skip them. WordPress consumed them for unrelated content.

This is a known architectural limitation. WooCommerce's own GitHub has an open issue (#2234) about it dating back to 2013. The core team's position is that sequential numbering is a plugin responsibility, not a core feature.

The Real-World Damage

9

Numbering & Order Sync Issues

The most reported sync problem: invoice numbers diverge from order IDs after cancellations, plugin reinstalls, or server migrations. Accounting software flags the gaps as missing transactions.

13

Fatal Errors During PDF Generation

Stripe checkout completion triggers a PDF generation hook. When the numbering counter conflicts with an existing ID, some plugins throw fatal errors — the customer gets charged but no invoice is generated.

19

Template & Format Breakage

Updating the numbering format (adding a prefix, changing the counter) can break existing PDF templates. The invoice renders but the number field shows the wrong format or reverts to the WordPress post ID.

EU

Tax Compliance Risk

In Germany (§14 UStG), France, Italy, Spain, and Poland, sequential invoice numbering is a legal requirement. Non-sequential invoices can trigger tax audit flags. Some countries impose penalties for numbering gaps.

Country-by-Country: Is Sequential Numbering Required?

Country Sequential Required? Regulation Penalty Risk
🇩🇪 Germany ✓ Yes — mandatory §14 UStG (VAT Act) Audit flag, potential VAT reassessment
🇫🇷 France ✓ Yes — mandatory Article 242 nonies I CGI €15 per non-compliant invoice, capped at 25% of total
🇮🇹 Italy ✓ Yes — mandatory DPR 633/72 Art. 21 Administrative penalties, e-invoicing audit triggers
🇪🇸 Spain ✓ Yes — mandatory Real Decreto 1619/2012 Sanctions for non-compliant invoice series
🇵🇱 Poland ✓ Yes — mandatory VAT Act Art. 106e KSeF mandatory e-invoicing enforces it automatically
🇳🇱 Netherlands ⚠ Recommended BTW administration requirements Disorganised records can trigger deeper audit
🇬🇧 United Kingdom ⚠ Recommended HMRC VAT Notice 700 No direct penalty but systematic numbering expected
🇺🇸 United States ✗ Not required No federal requirement None (but standard accounting practice)
🇦🇺 Australia ✗ Not required ATO GST rulings None (unique identification sufficient)

How Each Plugin Handles Invoice Numbering

Feature PDF Invoices & Packing Slips Flexible PDF Invoices Sliced Invoices Sequential Order Numbers Useful Patch
Sequential invoice numbers ✓ built-in ✓ built-in ⚠ via order ID ✓ replaces order IDs N/A — extraction
Custom prefix / suffix ✓ parsed
Set starting number Manual only N/A
Yearly reset option N/A
Survives plugin reinstall ⚠ if DB intact ⚠ if DB intact ⚠ if DB intact ✓ stored in order meta N/A
Handles HPOS (High-Performance Order Storage) ✓ recent versions ⚠ partial N/A
Extract number from existing PDFs ✓ any PDF
Reconcile gaps across systems ✓ date+amount match
Active installs 400,000+ 7,000+ 5,000+ 100,000+
Price Free / £69/yr Pro Free / £49/yr Pro Free / £99/yr Pro Free / $49 SkyVerge Free demo · £29/mo API

Common Scenarios That Break Numbering

Scenario 1

Plugin Reinstall or Server Migration

You migrate to a new host or reinstall the PDF invoice plugin. The numbering counter resets to 1 while WooCommerce orders continue from #4,502. Now you have invoice #1 against order #4,502 and your accountant wants to know where invoices 2–4,501 went.

Fix: Before anything else, set the "next invoice number" in the plugin settings to match your actual next order. If damage is done, export all existing PDFs and reconcile by date and amount.

Scenario 2

Cancelled Orders Consuming Numbers

A customer starts checkout, WooCommerce creates an order (consuming the next post ID), then the customer abandons. The order gets auto-cancelled but the ID is gone. The next real order skips a number.

Fix: Use a sequential numbering plugin that only assigns the invoice number when the order status reaches "processing" or "completed" — not at creation. Both PDF Invoices & Packing Slips and Sequential Order Numbers support this.

Scenario 3

Multiple Invoice Series

You sell physical products and digital products from the same WooCommerce store. Your accountant wants separate invoice series: PHYS-001, PHYS-002 for physical, DIG-001, DIG-002 for digital. Default plugins do not support this.

Fix: Use Flexible PDF Invoices with custom document types, or use the prefix/suffix feature with a filter hook to set the prefix based on product type. If PDFs are already generated, Useful Patch can extract and re-sort them by invoice prefix.

Scenario 4

Stripe Checkout Fatal Errors

Customer pays via Stripe. The payment completes but the PDF generation hook throws a fatal error because the numbering counter hits a conflict. Customer gets charged, you get no invoice PDF. Support forums are full of this exact pattern.

Fix: Update the PDF plugin. Check PHP version compatibility (DOMPDF needs PHP 7.4+). Test with WooCommerce default templates to isolate whether it is a numbering conflict or a PDF rendering issue.

How to Set Up Sequential Numbering (Step by Step)

Option A: WooCommerce PDF Invoices & Packing Slips (Built-in)

Go to WooCommerce → PDF Invoices → Documents → Invoice. Under "Number format", set your prefix (e.g. INV-), starting number, and padding (4 digits = 0001). Enable "Reset invoice number counter yearly" if your country allows annual series. The plugin maintains its own counter in the wp_options table, separate from WordPress post IDs.

Option B: Sequential Order Numbers Plugin

Install WooCommerce Sequential Order Numbers. It replaces the WordPress post ID on the order itself — not just the invoice. This means the WooCommerce admin, customer emails, and any PDF plugin all show the same sequential number. Set the starting number in WooCommerce → Settings → General → Sequential Order Numbers. This approach is cleaner but requires that all other plugins support the custom order number meta field.

Option C: Flexible PDF Invoices

Navigate to Invoices → Settings → Numbering. Set the next number, prefix, suffix, and choose whether to reset annually. Flexible Invoices stores the counter independently and supports multiple document types (invoice, proforma, correction) with separate sequences — useful if your tax authority requires distinct series for credit notes.

After Setup: Verify

Place two test orders in sequence. Check that the invoice numbers increment by exactly 1 with no gaps. Then cancel an order and place another — the next invoice should still be sequential. If it is not, the plugin is assigning numbers at order creation rather than completion. Check the "assign number" trigger setting.

Already Have Gaps? How to Reconcile

If your invoice numbers are already non-sequential and you need to reconcile with your accounting system, matching by invoice number alone will fail. Instead:

  1. Export all invoice PDFs from WooCommerce (bulk download or use a file manager).
  2. Extract structured data from each PDF — invoice number, date, line items, total, tax. Useful Patch does this in seconds per file and returns JSON you can pipe directly into a spreadsheet or accounting import.
  3. Match by date + amount instead of number. An invoice dated 2026-03-14 for £247.50 with 3 line items maps unambiguously to the corresponding order in 99% of cases.
  4. Flag duplicates — if two invoices share the same date and amount (rare but possible), add line item comparison as a tiebreaker.
  5. Start a clean sequence going forward. Set your next invoice number in the plugin to the correct value and do not change it again.

This reconciliation approach works whether your invoices came from WooCommerce, Xero, QuickBooks, or manual PDFs. The extraction step is format-agnostic.

Common Questions

Why are my WooCommerce invoice numbers not sequential?

WooCommerce uses WordPress post IDs for order numbers. These IDs are shared with pages, media, revisions, and other post types. Every non-order object that WordPress creates consumes an ID, leaving gaps in your invoice sequence. A sequential numbering plugin fixes this by maintaining a dedicated counter.

Is sequential invoice numbering legally required?

In most EU countries (Germany, France, Italy, Spain, Poland), yes — tax authorities require unbroken sequential invoice numbers. Gaps or duplicates can trigger audit flags and penalties. The UK recommends it but does not strictly enforce it. The US has no federal requirement.

How do I fix numbering gaps after migrating WooCommerce?

After migration, set the "next invoice number" in your PDF plugin to the correct next value immediately. If gaps already exist in historical invoices, export them and reconcile by matching on order date and amount rather than number. Useful Patch can extract the structured data from those PDFs to make this matching fast.

Which plugin handles sequential invoice numbers best?

WooCommerce Sequential Order Numbers replaces the order ID itself, giving the cleanest result. PDF Invoices & Packing Slips and Flexible PDF Invoices both maintain separate invoice counters that work independently of order IDs. Choose based on whether you want the sequence on the order level or just the invoice level.

Can I have multiple invoice number series in WooCommerce?

Flexible PDF Invoices supports multiple document types with separate numbering sequences. For other plugins, you can use a prefix filter hook to dynamically set the prefix based on product type or order category. This is common for stores that need separate series for physical vs digital products or domestic vs export sales.

What causes fatal errors during WooCommerce PDF invoice generation?

Most fatal errors occur when the PDF library (DOMPDF or TCPDF) encounters a PHP version incompatibility, a numbering counter conflict, or a malformed template after a plugin update. The most commonly reported pattern is Stripe checkout completing successfully but the PDF hook crashing — the customer gets charged but no invoice generates. Keep all plugins updated and test after every WooCommerce core update.

Invoice Numbers Already a Mess? Extract & Reconcile.

Upload any invoice PDF — WooCommerce, Xero, QuickBooks, or handmade — and get structured data back in seconds. Match by date and amount instead of fighting broken numbering.

Open Free Demo → Start Developer Plan — £29/mo View API Docs →