I recently ran into a fatal error issue when trying to create a new post or page:
2022-08-11T12:33:33+00:00 CRITICAL Uncaught Error: Call to a member function get_data_store() on bool in /home/cinchws/public_html/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wcs-initial-cart-stock-manager.php:85
Stack trace:
#0 /home/cinchws/public_html/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wcs-initial-cart-stock-manager.php(45): WCS_Initial_Cart_Stock_Manager::has_handled_stock(false)
#1 /home/cinchws/public_html/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wcs-renewal-cart-stock-manager.php(49): WCS_Initial_Cart_Stock_Manager::get_order_from_cart()
#2 /home/cinchws/public_html/wp-includes/class-wp-hook.php(307): WCS_Renewal_Cart_Stock_Manager::maybe_adjust_stock_checkout('')
#3 /home/cinchws/public_html/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array)
#4 /home/cinchws/public_html/wp-includes/plugin.php(476): WP_Hook->do_action(Array)
#5 /home/cinchws/publi in /home/cinchws/public_html/wp-content/plugins/woocommerce-subscriptions/vendor/woocommerce/subscriptions-core/includes/class-wcs-initial-cart-stock-manager.php on line 85
The error traced to a WooCommerce Subscriptions file, but the problem was isolated to my user account only. I went back and forth a little with WooCommerce.com support, but finally decided to solve it by creating a new user account for myself. Doing that ‘fixed’ it.
My guess is that there was something askew with my user account in the database. I could have poked around a bit more but sometimes a hard reset is the easiest solution.
If you’re not sure, here’s how to create a new user for yourself.
I will updated this post if I find out more on a more elegant solution.
UPDATE #2: See another comment from rumano referring to a built in tool to clear customer sessions: WooCommerce > Status > Tools. Another commenter confirmed that this tool works.
6 Comments
Thanks for posting this, Bryan. I had the exact same error regarding WooCommerce Subscriptions class-wcs-initial-cart-stock-manager.php:85 when using my primary Administrator user account. The crash occurred each time I tried to add or remove something from the cart. It also crashed when I used a Run Once Code Snippet to empty my cart programmatically (my first attempt to solve the problem).
I ended-up solving it a bit differently than your solution and figured I’d chime in. I temporarily deactivated Woo Subscriptions, cleared my cart on the front end, then re-activated WooCommerce Subscriptions. So far the problem has yet to return. Thanks again for posting this seemingly rare problem! It helped me isolate to my user account and provides a workable solution.
Thanks for taking the time to post your solution Sean. Much more elegant than mine. I’ve updated the post, thanks again.
Under WooCommerce > Status > Tools, there is an option for “Clear customer sessions. This tool will delete all customer session data from the database.
Thanks rumano, hopefully this works for others. Seems even easier if it works.
Worked perfectly for me. Thanks for posting your solution!
Thanks for verifying that Don. I’ve updated the post as well.
Comments are closed.