Closed markhowellsmead closed 4 years ago
I can reproduce, while we definitely have to handle the fatal condition, the route is designed to only work when there is a cart in session. So the first problem here is that there likely isn't a cart in session available when accessing the endpoint.
Please provide us with the information requested in this bug report. Without these details, we won't be able to fully evaluate this issue. Bug reports lacking detail, or for any other reason than to report a bug, may be closed without action.
Prerequisites (mark completed items with an [x]):
Describe the bug example.org/wp-json/wc/store/cart/items always fails with HTTP 500 and the following entry in the fatal errors log:
CRITICAL Uncaught Error: Call to a member function get_cart() on null in [[WEBROOT]]/wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/StoreApi/Utilities/CartController.php:410
Expected behavior The error should not occur.
Actual behavior The error noted above occurs.
Steps to reproduce the bug (We need to be able to reproduce the bug in order to fix it.) Steps to reproduce the bug:
Isolating the problem (mark completed items with an [x]):
WordPress Environment