Plugin Contributor
David G
(@gravid7)
Hi @zweigrafiker,
Thanks for reaching out to us.
PDF invoices cannot be opened properly on some servers due to an error log conflict. So added below code on you wp-config.php. The query plugin also follows this method. that’s why it was working when you activate it.
@ini_set( ‘log_errors’, ‘On’ );
@ini_set( ‘display_errors’, ‘Off’ );
define( ‘WP_DEBUG’, true );
define( ‘WP_DEBUG_LOG’, true );
define( ‘WP_DEBUG_DISPLAY’, false );
Hi David,
placing your code in the wp-config.php doesn’t fix the error. The PDF invoice works only with these settings:
wordpress version 6.8.1
woocommerce version 9.8.5
booster for woocommerce version 7.2.6
&
php version 7.4
as soon as setting the php-version higher than 7.4 the critical error occurs again!
Plugin Contributor
David G
(@gravid7)
Hi @zweigrafiker,
Thanks for your message.
If possible you can contact us from our website. So, we can take a deeper look and help you.
🔧 Fix for the PHP 8.2 “Unsupported operand types: string + int” error in Booster for WooCommerce PDF Invoices (TCPDF)
If you are encountering an error like this when generating PDF invoices in WooCommerce with the Booster plugin:
Fatal error: Uncaught TypeError: Unsupported operand types: string + int in /wp-content/plugins/booster-plus-for-woocommerce/includes/lib/tcpdf/tcpdf.php on line 5192
…here is the fix that worked for me. 🎯 The Problem
In PHP 8.2, adding a string and an integer (or float) is no longer allowed, and will throw a fatal error.
In the TCPDF library used by Booster, there is a line like this:
$y = $this->y + $this->cell_margin['T'];
If $this->y is a string (like an empty string ""), this addition causes the fatal error. ✅ The Solution (Minimal Patch)
Open the file:
/wp-content/plugins/booster-plus-for-woocommerce/includes/lib/tcpdf/tcpdf.php
Go to line 5192 (or search for this line):
$y = $this->y + $this->cell_margin['T'];
Change it to:
$y = (float)$this->y + (float)$this->cell_margin['T'];
This will force both variables to be treated as numbers, avoiding the error. 📌 Why this fix works
$this->y is sometimes initialized as an empty string in TCPDF, and adding it to a number (like $this->cell_margin['T']) is invalid in PHP 8.2.
- The patch safely converts both variables to floats, ensuring the calculation works as intended.
🛡️ Important
This is a targeted fix for the specific error in TCPDF when using Booster for WooCommerce on PHP 8.2.
It is a minimal change and works reliably without needing to patch the entire TCPDF library.