Background of the issue:
I am trying to generate WooCommerce PDF invoices on my production site, but I encounter a critical error when WPML is enabled. The same setup works perfectly on localhost. Additionally, WPML is attempting to load a Slovak localization file that returns a 404 error, which may be related to the issue. URLs: ❌ hidden link → 404 Not Found, ✅ hidden link → Loads correctly. Error occurs in:
Fatal error: wpo_wcpdf_dynamic_translate(): Argument #1 ($string) must be of type string, null given, called in /wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/Documents/OrderDocumentMethods.php on line 501
. WPML might be returning `NULL` instead of the correct translated string for the payment method. On production,
$this->get_payment_method()
and
$this->payment_method_title()
return `NULL`, while on localhost they return valid strings.
Questions:
Why is WPML returning `NULL` for payment methods only on production?
Is the missing `sk.json` file (404) causing translation failures? How can we fix this?
Is there a way to exclude WooCommerce PDF invoices from WPML's String Translation system?
Are there any known issues with WPML and WooCommerce PDF Invoices & Packing Slips related to payment method translation?
Can you guide us on how to debug this further?