Flexible Shipping generating repeated array_sum() PHP warnings
-
Hello,
We are experiencing a large volume of PHP warnings whenever shipping rates associated with Flexible Shipping are enabled.
The error is:
PHP Warning: array_sum(): Addition is not supported on type string in /wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-shipping-method.php on line 316
Environment:
- WordPress: 6.8.1
- WooCommerce: 9.9.5
- PHP: 8.3
- Flexible Shipping: 10.9.4
- Server: LiteSpeed with MariaDB
Our shipping zone contains:
- A Flexible Shipping method called “Tiered Shipping”
- A native Local Pickup method called “Collect from Shop (Ferndale)”, with the Flexible Shipping Rules Table additional-cost option
The warning has appeared more than 116,000 times. To isolate it, we conducted the following tests:
- Both methods enabled: warnings occur continuously.
- Tiered Shipping disabled, Flexible Shipping-enhanced Local Pickup enabled: 37 warnings were generated in approximately four minutes.
- Local Pickup disabled, Tiered Shipping enabled: 40 warnings were generated in approximately two and a half minutes.
- Both methods disabled: no array_sum() warnings were generated during the subsequent test period.
The Tiered Shipping rates are numeric and based on cart price. The Local Pickup method has a base cost of R0 and previously used the Flexible Shipping Rules Table to add R50 below a specified cart value.
This suggests that one or more Flexible Shipping calculations may be passing WooCommerce a cost array containing an empty or non-numeric string. WooCommerce then calls array_sum() on that array.
Could you please confirm:
- Whether this is a known compatibility issue with PHP 8.3 or our WooCommerce version
- Whether Flexible Shipping may return an empty string within the shipping-cost array
- Whether an update or recommended configuration change resolves it
- Whether you need a diagnostic log showing the method ID and contents of the cost array
I can provide screenshots, a WooCommerce System Status report and a sanitised log excerpt.
Kind regards,
Chris
The page I need help with: [log in to see the link]
You must be logged in to reply to this topic.