Hi @emrl,
I understand how concerning it is to encounter this kind of fatal error while using the Store API, especially with something as critical as the cart functionality. I’ll do my best to help figure out what’s going on here.
To help us investigate further, could you clarify where exactly you’re seeing this error? For example, is it in the browser console, a log file, or in a plugin integration? A screenshot or further details would really help, you can share one using https://snipboard.io.
Also, have you tried rolling back to WooCommerce version 10.2.2 to see if the error no longer occurs? That would help confirm if this is a regression introduced in 10.3.0.
From what you’ve shared, it looks like the issue stems from the use of get_session_data() on the Automattic\WooCommerce\StoreApi\SessionHandler class, which may no longer expose that method. If a custom plugin or theme is trying to interact with the session directly using that method, it could break now that WooCommerce has introduced more separation between session implementations.
If this is coming from custom code or a third-party plugin, updating that code to use WC()->session->get() and WC()->session->set() directly may help or refactoring to use the public WooCommerce cart/session API instead of assuming the internal session structure.
Let us know how it goes and feel free to share those additional details, we’re here to help!
Thread Starter
emrl
(@emrl)
@lovingbro We have Bugsnag installed, and it is reporting the error. It happens for any Store API endpoint, not just the one above.
POST /wp-json/wc/store/v1/cart/add-item
POST /wp-json/wc/store/v1/checkout
DELETE /wp-json/wc/store/v1/cart/items
Here is the full stack trace:
Error · Call to undefined method Automattic\WooCommerce\StoreApi\SessionHandler::get_session_data()
/wp-content/plugins/woocommerce/includes/class-wc-cart-session.php:689 WC_Cart_Session::remove_shipping_for_package_from_session
private function remove_shipping_for_package_from_session() {
$wc_session = WC()->session;
foreach ( array_keys( $wc_session->get_session_data() ) as $key ) {
if ( 0 === strpos( $key, 'shipping_for_package_' ) ) {
$wc_session->set( $key, null );
}
/wp-content/plugins/woocommerce/includes/class-wc-cart-session.php:426 WC_Cart_Session::set_session
/wp-content/plugins/woocommerce/includes/class-wc-cart.php:1459 WC_Cart::calculate_totals
/wp-content/plugins/woocommerce/includes/class-wc-cart-session.php:290 WC_Cart_Session::get_cart_from_session
/wp-content/plugins/woocommerce/includes/class-wc-cart.php:627 WC_Cart::get_cart
/wp-content/plugins/woocommerce/src/StoreApi/Utilities/CartController.php:39 Automattic\WooCommerce\StoreApi\Utilities\CartController::load_cart
/wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/AbstractCartRoute.php:180 Automattic\WooCommerce\StoreApi\Routes\V1\AbstractCartRoute::load_cart_session
/wp-content/plugins/woocommerce/src/StoreApi/Routes/V1/Checkout.php:147 Automattic\WooCommerce\StoreApi\Routes\V1\Checkout::get_response
/wp-includes/rest-api/class-wp-rest-server.php:1292 WP_REST_Server::respond_to_request
/wp-includes/rest-api/class-wp-rest-server.php:1125 WP_REST_Server::dispatch
/wp-includes/rest-api/class-wp-rest-server.php:439 WP_REST_Server::serve_request
/wp-includes/rest-api.php:459 rest_api_loaded
/wp-includes/class-wp-hook.php:324 WP_Hook::apply_filters
/wp-includes/class-wp-hook.php:348 WP_Hook::do_action
/wp-includes/plugin.php:565 do_action_ref_array
/wp-includes/class-wp.php:418 WP::parse_request
/wp-includes/class-wp.php:818 WP::main
/wp-includes/functions.php:1342 wp
/wp-blog-header.php:16 require
/index.php:4 [main]
This error was not happening in 10.2.2, only 10.3.0
Hi @emrl,
Thank you for getting back and for providing such a detailed response. Since you’re able to reproduce the issue and it affects all API endpoints, please open a report on GitHub at https://github.com/woocommerce/woocommerce/issues so the developers can review it directly and assist further with troubleshooting.
After creating the issue please feel free to share the link back here so we can also follow up and anyone who plays into this thread can also contribute. Let me know if you have any further questions.
It’s been a while since we heard back from you for this reason we are closing this thread.
If WooCommerce has been useful for your store and you appreciate the support you’ve received, we’d truly appreciate it if you could leave us a quick review here:
https://wordpress.org/support/plugin/woocommerce/reviews/#new-post
Feel free to open a new forum topic if you run into any other problem.