Back to Community

Troubleshooting Common PDF Invoices & Packing Slips Errors

Content

Why Am I Seeing PDF Invoice Errors and How Do I Fix Them?

Errors with the 'PDF Invoices & Packing Slips for WooCommerce' plugin can be frustrating, especially when they prevent you from generating crucial documents for your business. Based on common community reports, many issues stem from a few key areas: plugin conflicts, outdated custom code, or incorrect settings. This guide will walk you through the most frequent errors and their solutions.

1. "Document not available" or Preview Errors

The Problem: You see a message like "Document not available for order #XXXX" and cannot generate a PDF for any order.

Why it happens: This is typically a configuration issue, not a bug. The document might be disabled for the order's specific status.

How to fix it:

  1. Navigate to WooCommerce > PDF Invoices > Documents.
  2. Click on the Invoice document.
  3. Ensure the document is activated.
  4. Check the "Disable for" settings. If an order's status is checked here, the PDF will be disabled for orders with that status.

2. Fatal Errors and Critical Crashes (White Screen of Death)

The Problem: Your site crashes with a "Critical Error," "Fatal Error," or a blank white screen when trying to view, generate, or delete an order with a PDF.

Why it happens: This is often caused by a conflict with another plugin or theme, or by using outdated custom code that is no longer compatible with the latest plugin version.

How to fix it:

  1. Check the Error Logs: This is the most important first step. Go to WooCommerce > Status > Logs. Look for log files prefixed with fatal-errors or wpo-wcpdf. The error message inside will often point directly to the culprit.
  2. Identify the Conflict: The log may name another plugin or theme file. For example, Thread 16 shows a bug in a multi-currency plugin was the cause. Deactivate other plugins one by one to identify which one is causing the conflict, then contact that plugin's support.
  3. Update Custom Code: If the error points to your theme's functions.php or a custom PDF template file (like invoice.php), your code is likely using deprecated methods. See the next section for details.

3. Custom Code Causing "200: parsererror" or "Call to a member function on null"

The Problem: After a plugin update, customizations break, producing a parser error or a fatal error mentioning a function call "on null" or "on bool".

Why it happens: The 'PDF Invoices & Packing Slips for WooCommerce' team has phased out old, legacy code. Custom snippets that use direct order property access or outdated hooks will fail.

How to fix it: You must update your code to use modern methods.

  • Old code might use direct property access like $order->order_number or hooks like wpo_wcpdf_after_order_details with outdated parameters.
  • New code should use proper getter methods and updated filters. For example, the code from Thread 15 was updated to a new callback function that checks if the order object exists.
Example Fix: If you have a custom function that adds data to the PDF, always check if the $document->order object exists before trying to use it.
add_filter( 'wpo_wcpdf_packing_slip_title', function( $title, $document ) {
    if ( empty( $document->order ) ) { 
        return $title; 
    }
    $order_number = $document->get_order_number();
    $title = 'Packing Slip - #' . $order_number;
    return $title;
}, 10, 2 );

4. "You dont have sufficient permission" Error

The Problem: You get a permissions error when trying to download a PDF from the admin dashboard.

Why it happens: As seen in Thread 12, this can be caused by a conflict with another plugin that incorrectly modifies the PDF download URL, often multilingual plugins like WPML.

How to fix it:

  1. Inspect the download URL for strange characters like #038; which is an encoded ampersand (&).
  2. Temporarily deactivate other plugins to find which one is corrupting the URL.
  3. Contact the support team for the conflicting plugin, as they need to fix how they handle these URLs.

Summary: Your General Troubleshooting Checklist

  1. Check Settings First: Always verify the document is activated and its status settings.
  2. Consult the Logs: WooCommerce > Status > Logs is your best friend for diagnosing fatal errors.
  3. Conflict Test: Temporarily switch to a default theme (like Storefront) and disable all other plugins except WooCommerce and PDF Invoices. If the error stops, reactivate them one-by-one to find the conflict.
  4. Update Your Code: Review any custom code in your theme's functions.php or custom PDF templates. Ensure it uses modern methods and includes checks to ensure the order object exists.
  5. Check for Known Issues: Some plugins, like certain multi-vendor or multi-currency extensions, are known to have compatibility issues. You may need to contact their developers for a fix.

By following these steps, you can resolve the majority of common errors encountered with the PDF Invoices & Packing Slips plugin.

Related Support Threads Support