• Resolved tamar

    (@tamar)


    I am trying to use a REST-API integration with WooCommerce 8.4.0 (specifically, PirateShip, which I’ve used successfully in the past). It connects but it can’t fetch the WooCommerce data, and I noticed the following in the logs.

    [26-Dec-2023 22:54:22 UTC] PHP Warning: array_sum(): Addition is not supported on type string in /home/public_html/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-orders-v1-controller.php on line 271

    I’m wondering if this is why PirateShip isn’t working, and how exactly do I get around this? Would rolling back a couple versions at least get the connetiction working? I’m compelled to give that a shot… but would rather fix the current version.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter tamar

    (@tamar)

    This is the associated code on line 271 (in bold)

    
                            if ( ! empty( $shipping_taxes['total'] ) ) {
                                    $shipping_line['total_tax'] = wc_format_decimal( array_sum( $shipping_taxes['total'] ), $dp );
    
                                    foreach ( $shipping_taxes['total'] as $tax_rate_id => $tax ) {
                                            $shipping_line['taxes'][] = array(
                                                    'id'       => $tax_rate_id,
                                                    'total'    => $tax,
                                            );
                                    }

    Kind of lost here. I’m looking at my taxes and they’re the same as they’ve always been. This code seems to have existed from WooCommerce 7.x and up.

    And yes, I rolled back to WP 2.x, kept incrementally increasing to 3, 4, 5, 6, all of which threw fatal errors till 7.x.

    Thread Starter tamar

    (@tamar)

    Evidently this is a known bug specifically related to PHP 8.3. I downgraded to 8.2 and it works.

    https://github.com/woocommerce/woocommerce/pull/41205

    Gonna hope they fix it soon.

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hey @tamar,

    As you know, our team is already aware of this issue.

    At the time being, we can’t give you an estimate for when the team will look into or fix the issue, as bug reports are prioritized based on a few criteria.

    I’ll be marking the thread as solved for now, but feel free to open a new one if you have any other questions.

    Thanks!

    Thread Starter tamar

    (@tamar)

    Yup, got my answer, thanks!

    PHP 8.2 Fixes issue

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PHP Warning: array_sum(): Addition is not supported’ is closed to new replies.