Back to Community

Troubleshooting Common Fatal Errors in PDF Invoices & Packing Slips for WooCommerce

Content

Users of the 'PDF Invoices & Packing Slips for WooCommerce' plugin sometimes encounter fatal errors that prevent them from generating crucial documents. Based on community reports, this guide covers the most common errors, their likely causes, and steps you can take to resolve them.

Common Error 1: Call to a member function is_allowed() on bool

Error Message Example:
Fatal error: Call to a member function is_allowed() on bool in .../woocommerce-pdf-invoices-packing-slips/includes/wcpdf-functions.php on line 81

Why This Happens:
This error typically occurs when the plugin tries to retrieve a document type that does not exist. This can be triggered by a typo in a URL parameter (like document_type=invoic1e), an outdated custom PDF template, or a conflict with another plugin that is incorrectly calling the document generation function.

How to Fix It:

  1. Check for Typos: If you are generating documents via a custom link, ensure the document_type parameter is correct (e.g., invoice, packing-slip).
  2. Switch to the Simple Template: A very common cause is an outdated custom template. To test this, temporarily switch to the default "Simple" template under WooCommerce > PDF Invoices > General > Choose a template. If the error disappears, your custom template needs to be updated to be compatible with the current plugin version.
  3. Check for Plugin Conflicts: Another plugin might be causing the issue. As seen in one thread, an Italian invoice integration plugin was triggering the error. Temporarily disable other plugins one by one to see if the error resolves.

Common Error 2: Call to undefined method is_admin_page()

Error Message Example:
Uncaught Error: Call to undefined method AutomatticWooCommerceAdminPageController::is_admin_page() in .../class-wcpdf-order-util.php:56

Why This Happens:
This is a compatibility error that arises from a mismatch between the plugin and the WooCommerce version. The is_admin_page() method was removed in a newer version of the WooCommerce Admin package, but the PDF plugin code was still trying to use it.

How to Fix It:

  1. Update Everything: The primary solution is to ensure you are running the latest versions of WordPress, WooCommerce, and the PDF Invoices plugin. The 'PDF Invoices & Packing Slips for WooCommerce' team has likely addressed this compatibility issue in a more recent update.
  2. If Updating is Not an Option: If you cannot update WooCommerce or WordPress (e.g., due to theme constraints), you may need to manually patch the code. However, this is not recommended as it can lead to further issues and will be overwritten on the next plugin update. The safest long-term solution is to update your core software.

Common Error 3: Paper Size & Custom Function Errors

Error Message Examples:

  • Argument #1 ($callback) must be a valid callback, function “wcpdf_a6_packing_slips” not found
  • Argument passed to DompdfDompdf::setPaper() must be of the type string, null given

Why This Happens:
These errors are almost always related to custom code. The first error indicates a custom function (e.g., for a custom paper size) that is missing or has a typo in its name. The second error suggests that a filter returning a paper size is returning a null value instead of a string like 'a4' or 'letter'.

How to Fix It:

  1. Review Custom Code Snippets: If you have added custom code to your theme's functions.php file or via a code snippets plugin, review it carefully for typos, missing functions, or incorrect return values.
  2. Disable Custom Code: Temporarily remove any custom code related to PDF generation to see if the error is resolved. If it is, you know the custom code is the source of the problem.

General Troubleshooting Steps

If you encounter an error not listed above, try these steps:

  1. Conflict Test: Temporarily switch to a default WordPress theme (like Twenty Twenty-Four) and disable all plugins except WooCommerce and PDF Invoices. If the error goes away, re-enable your plugins and theme one by one to identify the culprit.
  2. Check Logs: WooCommerce has built-in error logging. Check for logs under WooCommerce > Status > Logs. Look for log files with the wpo-wcpdf- or fatal-errors- prefix, as they often contain detailed error information.
  3. Reinstall the Plugin: As a last resort, try deleting the plugin and installing it again from the WordPress repository. This can replace any corrupted core plugin files.

Remember, keeping your WordPress core, WooCommerce, and all plugins updated is the best defense against these types of compatibility errors.