We’ve seen several occurrences of HTTP errors in Magento involving endpoint URLs that contain the
guest-carts keyword, which represents guest users. The errors usually involve HTTP 400 or HTTP 404 error responses from the server, but we have seen the error throw other HTTP responses. Unfortunately, these errors are tricky to resolve, but they may have a serious impact on a customer's ability to complete their checkout.
These HTTP errors can have numerous potential causes, so it's important to conduct an investigation and diagnose the source of the specific error at hand. Follow this guide to investigate potential sources, and take full advantage of the tools and resources provided.
As a user browses your Magento site, the site makes different HTTP requests to the Magento server. When the user begins the checkout process as a guest, these request URLs include the
guest-carts keyword followed by a token that identifies the user's Magento cart session. We will refer to this as CART_ID.
The CART_ID is used in numerous URLs during the checkout process. Below is a list of common URLs that trigger HTTP errors:
*/guest-carts/<CART_ID>/totals-information */guest-carts/<CART_ID>/totals */guest-carts/<CART_ID>/payment-information */guest-carts/<CART_ID>/set-payment-information */guest-carts/<CART_ID>/shipping-information */guest-carts/<CART_ID>/estimate-shipping-methods */guest-carts/<CART_ID>/coupons
As mentioned, we’ve seen errors occur most frequently with error code HTTP 400 or HTTP 404. However, HTTP errors with other error codes can certainly occur. For more information visit Magento's guide to Common Error HTTP Codes in Magento Rest API.
We recommend first investigating Magento's Log Files. These can provide some useful additional context for HTTP errors, and may clarify what has occurred.
You can find the logs through the /var/log path in your root Magento installation. You may need to access them via SSH.
For further information, visit the articles below:
- Magento Logger: A Better Way to Understand Your Application and Make Better Decisions for It
- Adobe's Log Reference
As of December 2022, the latest release of Magento is version 2.4.5. Earlier versions of Magento are no longer supported; support for Versions 2.3.x ended as of September 2022. In some cases, the
guest-carts HTTP errors may be caused by pre-existing bugs on the Magento platform. If your investigation reveals that this is the problem, you may not get direct support if your store is on Magento 2.3.x or older.
The Magento platform supports Swagger documentation, which allows you to generate local documentation for all API endpoints on your Magento platform including the
guest-carts endpoints. Visit Adobe's Guide to Generating a Local Rest Reference for a walkthrough of this process.
If you are using the latest version of Magento, Adobe also provides a Web-Hosted Version of the Documentation.
Potential Error Causes
Note: The examples below may not apply to your version of Magento. Check your HTTP requests against your Magento version’s API documentation to confirm.
Error Cause #1: Invalid HTTP Requests
These Magento HTTP errors may be occurring because the request being made to the Magento server is invalid. There are two ways an HTTP request can be invalid:
- The request URL is incorrect.
- This could happen when using the Wrong CART_ID in the URL.
- The request payload is incorrect.
To better debug HTTP request payload errors, it could be helpful to process the HTTP error response body. For certain responses like HTTP 400, this body will likely provide the exact reason why the request failed.
Error Cause #2: Known Magento Platform Bugs
Issue 1: HTTP Error 400 on guest-carts/<CART_ID>/totals-information
This error impacts both Magento 2.3.x and 2.4.x and occurs when a user adds a product to their cart as a guest, and then tries to login during the checkout process. The error doesn’t cause the login to fail, but triggers a No Such Entity error popup. This error was resolved in later versions of Magento 2.4, but Magento has also released a patch that you can apply manually. Visit the Github Resource for more information.
Issue 2: HTTP Error 400 guest-carts/<CART_ID>/set-payment-info
In some cases, Magento prematurely fires an HTTP request to the
set-payment-info endpoint. This triggers a 400 error, as the user's payment information hasn’t been properly filled out and therefore fails validation.
The solution is to disable the Magento Mixin
Magento_SalesRule/js/action/select-payment-method-mixi with a manual patch.
See the Github Resource for more details.
Error Cause #3: Other Cases
There are several potential causes for these HTTP errors. For example, a CART_ID May Expire after an extended period and may not be usable during the checkout process.
If you have any questions or require further details, please reach out to us at email@example.com.