• Hello,

    Thank for your work on the plug-in, it helped us a lot!

    Recently we’ve started to see a lot of entries in the php_errorlog generated by the plugin that look like this:

    [01-Oct-2023 12:00:00 UTC] PHP Fatal error:  Uncaught Error: Call to a member function get_cart() on null in /path/wp-content/plugins/wc-place-order-without-payment/wc-place-order-without-payment.php:258
    Stack trace:
    #0 /path/wp-content/plugins/wc-place-order-without-payment/wc-place-order-without-payment.php(238): WPOWP\WPOWP_Loader->disable_payment()
    #1 /path/wp-content/plugins/wc-place-order-without-payment/wc-place-order-without-payment.php(151): WPOWP\WPOWP_Loader->skip_payment()
    #2 /path/wp-content/plugins/wc-place-order-without-payment/wc-place-order-without-payment.php(140): WPOWP\WPOWP_Loader->run_plugin()
    #3 /path/wp-includes/class-wp-hook.php(310): WPOWP\WPOWP_Loader->before_plugin_load('')
    #4 /path/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters(NULL, Array)
    #5 /path in /path/public_html/wp-content/plugins/wc-place-order-without-payment/wc-place-order-without-payment.php on line 258

    While it seems to be a known issue that WC()->cart (which is the part that provokes the error) could be null:
    https://woocommerce.github.io/code-reference/files/woocommerce-includes-class-woocommerce.html#source-view.102
    https://www.ads-software.com/support/topic/wp-cart-is-null/

    Could you please fix it by adding an additional check for the case if WC()->cart is null?

    Best,

  • The topic ‘Plugin calls get_cart on null’ is closed to new replies.