Quote from skysolution on June 13, 2025, 12:18
Hi support.
I’m encountering a fatal PHP error on my WooCommerce store that originates from your plugin WOOCS – WooCommerce Currency Switcher. The server log reports the following error:
PHP Fatal error: Uncaught TypeError: Unsupported operand types: string * float in /wp-content/plugins/woocommerce-currency-switcher/classes/woocs.php:4132
The issue occurs in the woocommerce_package_rates() function, specifically in this line:
$value = $rate->cost * $currencies[$this->current_currency]['rate'];
It seems that in some cases, $rate->cost or the currency rate is stored as a string (e.g. "125,00"), which causes a fatal error when attempting multiplication.
To prevent this, a type cast could be added:
$value = floatval($rate->cost) * floatval($currencies[$this->current_currency]['rate']);
Is this a known issue, and will it be addressed in a future update?
Thanks in advance for your support.
Hi support.
I’m encountering a fatal PHP error on my WooCommerce store that originates from your plugin WOOCS – WooCommerce Currency Switcher. The server log reports the following error:
PHP Fatal error: Uncaught TypeError: Unsupported operand types: string * float in /wp-content/plugins/woocommerce-currency-switcher/classes/woocs.php:4132
The issue occurs in the woocommerce_package_rates() function, specifically in this line:
$value = $rate->cost * $currencies[$this->current_currency]['rate'];
It seems that in some cases, $rate->cost or the currency rate is stored as a string (e.g. "125,00"), which causes a fatal error when attempting multiplication.
To prevent this, a type cast could be added:
$value = floatval($rate->cost) * floatval($currencies[$this->current_currency]['rate']);
Is this a known issue, and will it be addressed in a future update?
Thanks in advance for your support.