PHP Fatal error: Uncaught Error: Call to undefined function wc_empty_cart()
-
Hi, I struggle with the following error which seems to be triggered by your plugin:
PHP Fatal error: Uncaught Error: Call to undefined function wc_empty_cart() in /wp-content/plugins/woocommerce/includes/class-wc-session-handler.php:372\nStack trace:\n#0 /wp-content/plugins/woocommerce/includes/class-wc-session-handler.php(363): WC_Session_Handler->forget_session()\n#1 /wp-content/plugins/woocommerce/includes/class-wc-session-handler.php(99): WC_Session_Handler->destroy_session()\n#2 /wp-content/plugins/woocommerce/includes/class-wc-session-handler.php(71): WC_Session_Handler->init_session_cookie()\n#3 /wp-content/plugins/woocommerce/includes/class-woocommerce.php(825): WC_Session_Handler->init()\n#4 /wp-content/plugins/flexible-shipping-ups/src/Plugin/Plugin.php(275): WooCommerce->initialize_session()\n#5 /wp-includes/class-wp-hook.php(307): WPDesk\\FlexibleShippingUps\\Plugin->init_ups_access_points(”)\n#6 /wp-includes in /wp-content/plugins/woocommerce/includes/class-wc-session-handler.php on line 372, referer: /wp-admin/edit.php?post_type=shop_order
I understand the error is being triggered by init_ups_access_points() function that runs WC()->initialize_session(); in your plugin. This ends up in calling WC_Session_Handler->forget_session() which calls wc_empty_cart() that doesn’t exist at the moment of making the call.
I was unable to recreate this problem when logging in via /wp-admin or via accessing /wp-admin/edit.php?post_type=shop_order when both logged and unlogged, yet the error is being triggered from time to time.
I completed all the troubleshooting checks from this post https://www.ads-software.com/support/topic/troubleshooting-please-read-before-posting/ and everything is set up correctly.
Finally, both plugins (UPS shipping and WooCommerce) are updated to the newest version. WP core is also updated.
Could you support me with the error, please? Thank you for any advice,
Regards,
Karolina
- The topic ‘PHP Fatal error: Uncaught Error: Call to undefined function wc_empty_cart()’ is closed to new replies.