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:
- Navigate to WooCommerce > PDF Invoices > Documents.
- Click on the Invoice document.
- Ensure the document is activated.
- 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:
- Check the Error Logs: This is the most important first step. Go to WooCommerce > Status > Logs. Look for log files prefixed with
fatal-errorsorwpo-wcpdf. The error message inside will often point directly to the culprit. - 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.
- Update Custom Code: If the error points to your theme's
functions.phpor a custom PDF template file (likeinvoice.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_numberor hooks likewpo_wcpdf_after_order_detailswith 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.
$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:
- Inspect the download URL for strange characters like
#038;which is an encoded ampersand (&). - Temporarily deactivate other plugins to find which one is corrupting the URL.
- Contact the support team for the conflicting plugin, as they need to fix how they handle these URLs.
Summary: Your General Troubleshooting Checklist
- Check Settings First: Always verify the document is activated and its status settings.
- Consult the Logs: WooCommerce > Status > Logs is your best friend for diagnosing fatal errors.
- 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.
- Update Your Code: Review any custom code in your theme's
functions.phpor custom PDF templates. Ensure it uses modern methods and includes checks to ensure the order object exists. - 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
-
Document preview error…https://wordpress.org/support/topic/document-preview-error/
-
internal Server Error by “Deactivate for free orders”https://wordpress.org/support/topic/internal-server-error-by-deactivate-for-free-orders/
-
Error 200: parsererrorhttps://wordpress.org/support/topic/error-200-parsererror-2/
-
Warning -Doing it wronghttps://wordpress.org/support/topic/warning-doing-it-wrong/
-
Critical Errorhttps://wordpress.org/support/topic/critical-error-662/
-
internal Server Error by “Deactivate for free orders”https://wordpress.org/support/topic/internal-server-error-by-deactivate-for-free-orders-2/
-
Fatal error: str_replace(): – Only happens with completed ordershttps://wordpress.org/support/topic/fatal-error-str_replace-only-happens-with-completed-orders/
-
critical error when redirecting from the payment gateway to the thank you pagehttps://wordpress.org/support/topic/critical-error-when-redirecting-from-the-payment-gateway-to-the-thank-you-page/
-
order properties should not access directlyhttps://wordpress.org/support/topic/order-properties-should-not-access-directly/
-
is_internal_meta_key was called incorrectlyhttps://wordpress.org/support/topic/is_internal_meta_key-was-called-incorrectly-4/
-
2 refunds on 1 order gives error in apihttps://wordpress.org/support/topic/2-refunds-on-1-order-gives-error-in-api/
-
Downloading pdf from orders page or single order page showing permission errorhttps://wordpress.org/support/topic/downloading-pdf-from-orders-page-or-single-order-page-showing-permission-error/
-
Error in WCFM order page.https://wordpress.org/support/topic/error-in-wcfm-order-page/
-
Duplicated ordershttps://wordpress.org/support/topic/duplicated-orders-12/
-
Error 200: parsererrorhttps://wordpress.org/support/topic/error-200-parsererror-3/
-
Critical Error When Trying To Open PDF From Order Page.https://wordpress.org/support/topic/critical-error-when-trying-to-open-pdf-from-order-page/
-
200 parse errorhttps://wordpress.org/support/topic/200-parse-error/
-
Critical Error when changing Packing Slip Titlehttps://wordpress.org/support/topic/critical-error-when-changing-packing-slip-title/
-
200 parse errorhttps://wordpress.org/support/topic/200-parse-error-2/
-
Object of class stdClass could not be converted tohttps://wordpress.org/support/topic/object-of-class-stdclass-could-not-be-converted-to/