• Resolved jamieplexus

    (@jamieplexus)


    We have had customers on our shop reporting an error on checkout. We checked the server logs and we saw the following error;

    Got error ‘PHP message: PHP Fatal error: Uncaught TypeError: array_keys(): Argument #1 ($array) must be of type array, null given in /home/sites/11b/f/xxxxxxxxxx/public_html/wp-content/plugins/woocommerce/includes/wc-cart-functions.php:476\nStack trace:\n#0 /home/sites/11b/f/xxxxxxxxxx/public_html/wp-content/plugins/woocommerce/includes/wc-cart-functions.php(476): array_keys(NULL)\n#1 /home/sites/11b/f/xxxxxxxxxx/public_html/wp-content/plugins/woocommerce/includes/wc-cart-functions.php(412): wc_shipping_methods_have_changed(0, Array)\n#2 /home/sites/11b/f/xxxxxxxxxx/public_html/wp-content/plugins/woocommerce/includes/class-wc-cart.php(1451): wc_get_chosen_shipping_method_for_package(0, Array)\n#3 /home/sites/11b/f/xxxxxxxxxx/public_html/wp-content/plugins/woocommerce/includes/class-wc-cart.php(1420): WC_Cart->get_chosen_shipping_methods(Array)\n#4 /home/sites/11b/f/xxxxxxxxxx/public_html/wp-content/plugins/

    Could this please be investigated ASAP.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @jamieplexus!

    This kind of issue could be related to a conflict between WooCommerce and your theme or another plugin; an outdated or malfunctioning code could be interfering.

    To be sure of this, please perform a conflict test by temporarily switching your theme back to Storefront, disabling all plugins except WooCommerce, and then check again if the issue persists.

    If that solves it, reactivate the theme first and check again. Then, reactivate your other plugins, testing after each, until you find the one causing conflict.

    If you cannot perform a conflict test on your live site, we recommend creating a staging site using the WP Staging plugin.

    You can find a more detailed explanation of how to do a conflict test here: https://docs.woocommerce.com/document/how-to-test-for-conflicts/.

    Let us know how that goes for you!

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – we’ll be here if and/or when you are ready to continue.

    Thanks.

    I got this same exact error today on a dev site with the default Twenty Twenty-Two theme enabled. It reproduced with no other plugins than WooCommerce active until I reset PHP (caching), then I was able to trace it down to custom functions and PHP 8.0 sensitivity.

    I was able to fix this by downgrading from PHP v8.0 to v7.4. Re-enabling PHP 8.0 doesn’t reproduce the problem right off, but it eventually came-up.

    I traced the trouble to a custom function filtering woocommerce_package_rates. Here’s the repaired function: https://codedcommerce.com/woo/sort-shipping-methods-by-price/

    @seanconklin Excellent!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Error on checkout’ is closed to new replies.