WooCommerce Troubleshooting

WooCommerce PDF Invoice Fatal Errors — Every Fix in One Place

Stripe checkout completes, customer gets charged, but the invoice PDF never generates. Sound familiar? Here's every known cause and fix, tested across the six plugins that hit this bug most often.

Jump to Error Map ↓ Recover Invoice Data →

The 6 Most Common Fatal Errors (and How to Fix Each One)

Error #1 — Memory Limit

PHP Fatal Error: Allowed memory size exhausted

The PDF rendering library (DOMPDF or TCPDF) runs out of memory during generation. Happens most with invoices that embed company logos, custom fonts, or have 20+ line items. The default WordPress memory limit of 64MB is not enough.

Fix: Add define('WP_MEMORY_LIMIT', '256M'); to wp-config.php. Verify it took effect in WooCommerce → Status → System Status. If your host caps PHP memory lower than 256MB, contact them or switch hosts.
Error #2 — Stripe + PDF Hook Crash

Fatal error during PDF generation after Stripe checkout

Stripe processes the payment. WooCommerce fires the woocommerce_order_status_completed hook. The PDF invoice plugin tries to generate the invoice but crashes. Customer is charged, you have no invoice. This is the most reported pattern in WordPress support forums.

Fix: Update all plugins. Check PHP error log for the exact line. Most commonly it's a DOMPDF autoload conflict — add define('DOMPDF_ENABLE_AUTOLOAD', false); before the plugin loads, or switch the PDF engine to TCPDF in the plugin settings if available.
Error #3 — Template Rendering

Unexpected block value / malformed template

After a plugin update, the invoice template contains an unexpected block type or incompatible Gutenberg markup. The PDF renderer cannot parse the template and throws a fatal error. Reported across Flexible PDF Invoices and Print Invoice & Delivery Notes.

Fix: Switch to the default invoice template in the plugin settings. If the error clears, your custom template needs updating. Re-build the template from the new default, migrating customisations one section at a time to isolate the break.
Error #4 — Sequential Numbering Conflict

Invoice number counter conflict / duplicate key

Two orders complete simultaneously (common with Stripe webhooks). Both try to claim the same invoice number. One succeeds, the other throws a database conflict or fatal error. More frequent on high-traffic stores.

Fix: Update to the latest plugin version — most have added row-level locking since 2024. If using a custom numbering solution, wrap the counter increment in a MySQL transaction with SELECT ... FOR UPDATE. Test with WooCommerce's built-in "Process order" button on two orders simultaneously.
Error #5 — PHP Version Incompatibility

Class not found / method signature mismatch

DOMPDF 2.x requires PHP 7.4 minimum. Some invoice plugins bundle an older DOMPDF version that breaks on PHP 8.1+. After a PHP upgrade on your server, invoice generation suddenly fails with "class not found" or "method signature mismatch" errors.

Fix: Update the PDF invoice plugin to the latest version (most now support PHP 8.1+). If the plugin hasn't been updated, check the GitHub issues for a compatibility patch. As a temporary workaround, you can pin PHP to 8.0 via your hosting panel.
Error #6 — Missing Font / Image

DOMPDF: Unable to load font / image not found

Your invoice template references a custom font file or logo image that was moved, deleted, or has incorrect permissions after a migration. DOMPDF tries to load it, fails, and the entire PDF generation crashes rather than falling back gracefully.

Fix: Check the PDF plugin's font/image settings and verify the file paths are correct. Re-upload your logo. For custom fonts, place the .ttf file in the DOMPDF fonts directory (usually wp-content/plugins/[plugin]/lib/dompdf/lib/fonts/). Set file permissions to 644.

Which Plugins Are Affected?

Error frequency based on WordPress support forum data from the last 6 months across 8 WooCommerce invoice plugins.

Plugin Active Installs Rating Resolved (2mo) Top Error Types
Print Invoice & Delivery Notes 30,000+ 4.6 4/12 (33%) Template rendering, field mapping, numbering
Flexible PDF Invoices 7,000+ 4.4 3/3 (100%) Sequential numbering, template blocks, translation
WP ERP (Accounting Suite) 6,000+ 4.4 0/0 Customer workflow, field mapping, tax config
Sliced Invoices 5,000+ 4.6 1/2 (50%) Debug log errors, HPOS storage, client features
Bulgarisation for WooCommerce 5,000+ 5.0 4/4 (100%) TypeError null reading, UI customisation
PostFinance Checkout 1,000+ 1.8 0/1 (0%) Webhook failures, order status overwrite, update errors

Emergency Debugging Checklist

When PDF invoice generation fails and customers are getting charged without invoices, follow this checklist in order:

Recovering Missing Invoices After a Crash

If PDF generation crashed on multiple orders, you have charged customers with no invoice on file. Here's how to recover:

Option 1: Regenerate from WooCommerce

Once you've fixed the underlying error, go to WooCommerce → Orders. Select the affected orders. Most PDF invoice plugins add a "Regenerate Invoice" or "Create PDF" button on the order edit screen. Click it for each affected order. This works if the plugin is now stable.

Option 2: Bulk Export + External Generation

If the plugin is still unstable and you can't wait, export the affected orders as CSV (WooCommerce → Orders → Export). Use the CSV data to generate invoices outside WordPress — through your accounting software (Xero, QuickBooks, FreeAgent) or a template tool.

Option 3: Extract from Existing PDFs

If you have some invoices as PDFs but need to reconcile them against orders where PDFs are missing, use an extraction tool to pull structured data (invoice number, date, line items, totals, tax) from the PDFs you do have. Then match against your order list by date and amount to identify which orders are missing invoices.

Useful Patch extracts structured JSON from any invoice PDF — WooCommerce, Xero, QuickBooks, or handmade. Upload the PDF, get back every field as structured data. No file leaves your browser during extraction.

Prevention: Decouple Payment from PDF

The root architectural problem is that WooCommerce hooks PDF generation into the same request that processes payment. If the PDF hook crashes, it can affect the order status even though Stripe already captured the funds. The safest pattern is to generate invoices asynchronously — via a background job (Action Scheduler) that runs after the payment hook completes. Some newer plugin versions support this. Check your plugin's settings for "async PDF generation" or "background processing".

Memory Limit Fix: Step by Step

This is the fix for the single most common WooCommerce PDF invoice fatal error.

1. Edit wp-config.php

// Add BEFORE the line "That's all, stop editing!"
define('WP_MEMORY_LIMIT', '256M');
define('WP_MAX_MEMORY_LIMIT', '512M');

2. Check php.ini (or .htaccess)

Some hosts ignore the WordPress constant and use the PHP-level limit instead. Add to php.ini:

memory_limit = 256M

Or to .htaccess (Apache only):

php_value memory_limit 256M

3. Verify It Worked

Go to WooCommerce → Status → System Status. The "WP Memory Limit" line should show 256M or higher. If it still shows 64M or 128M, your host is overriding the setting — contact their support.

4. Test PDF Generation

Place a test order with your most complex product (the one with the most line items, longest description, and any attached images). Generate the invoice. If it works, you're done. If it still crashes, the error is not memory-related — go back to the debugging checklist above.

Common Questions

Why does WooCommerce throw a fatal error when generating PDF invoices?

Usually PHP memory is too low for the PDF library (DOMPDF/TCPDF). Invoices with logos, custom fonts, or 20+ line items are the trigger. Plugin conflicts after WooCommerce updates are the second most common cause. Check your PHP error log for the exact error to know which case you're dealing with.

Customer got charged via Stripe but no invoice PDF was generated?

Stripe processes payment independently of PDF generation. If the PDF hook crashes, the payment still goes through. Check WooCommerce logs for the fatal error timestamp. Fix the underlying issue (usually memory or plugin conflict), then regenerate the invoice from the order edit screen.

How much PHP memory does PDF invoice generation need?

Simple text invoices: ~64MB. Invoices with logos and custom fonts: 128–256MB. If using DOMPDF with embedded images: 256MB minimum. Set it in wp-config.php and verify through WooCommerce system status.

Which plugin has the fewest fatal error reports?

Flexible PDF Invoices (7,000 installs) resolved 100% of support threads in the last 2 months. Print Invoice & Delivery Notes (30,000 installs) has a solid 4.6 rating. PostFinance Checkout (1,000 installs, 1.8 rating) has the most issues relative to its user base.

Can I generate invoices asynchronously to avoid crashes during checkout?

Yes. Some plugins support background/async PDF generation via WooCommerce's Action Scheduler. This decouples payment processing from PDF rendering, so even if the PDF fails, the order completes normally. Check your plugin's settings for "async" or "background processing" options. If it doesn't support it natively, you can hook into woocommerce_order_status_completed with a lower priority and use as_schedule_single_action() to defer generation.

How do I recover invoice data from orders where PDF generation failed?

The order data is still in WooCommerce. Fix the error, then regenerate PDFs from the order edit screen. For bulk recovery, export orders as CSV and use your accounting software or Useful Patch to create/extract the invoices third-partyly.

Invoice PDFs Missing After a Crash? Extract & Reconcile.

Upload any invoice PDF and get structured data back in seconds. Match against your WooCommerce orders by date and amount when invoice numbers don't line up.

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