cancel
Showing results for 
Search instead for 
Did you mean: 

No such entity with cartId when adding item to cart after PHP upgrade

No such entity with cartId when adding item to cart after PHP upgrade

We have an issue on Magento 2.4.5 where customers get an error saying "No such entity with cartId = xxxx" when they try to add an item to their cart. Most of the time, this happens after we perform a PHP upgrade. My assumption is that some sort of session identifier is being cleared out during the upgrade, and when the customer comes back to the site, whatever identifier was stored in their cookies no longer matches an identifier on the site. Has anyone else experienced this, and are there any workarounds or fixes other than asking users to clear their cookies?

1 REPLY 1

Re: No such entity with cartId when adding item to cart after PHP upgrade

 

Hello @cbdpeter 

 

The "No such entity with cartId" error in Magento 2 when adding an item to the cart after a PHP upgrade can be caused by various issues, such as session management problems, corrupted cart data, or issues with extensions that are not compatible with the new PHP version. Here are some steps to troubleshoot and resolve this issue:

 

Check PHP Compatibility

Ensure that all Magento core files and third-party extensions are compatible with the new PHP version. Magento has specific PHP version requirements, and using an incompatible version can cause issues.

 

Clear Cache and Session

Clear the Magento cache and session data. This can resolve issues related to old cached data or session inconsistencies.

php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento setup:upgrade
php bin/magento indexer:reindex

 

Inspect and Clean the quote Table

Check the quote and quote_item tables in the database for any inconsistencies. You can truncate these tables if you suspect that they contain corrupted data (note that this will remove all current cart data).

Make sure to back up your database before running these commands.

 

TRUNCATE TABLE quote;
TRUNCATE TABLE quote_item;
TRUNCATE TABLE quote_address;
TRUNCATE TABLE quote_shipping_rate;
TRUNCATE TABLE quote_payment;

Check Session Storage Configuration   

Verify that the session storage configuration is set correctly. Magento supports multiple session storage options (files, database, Redis, etc.).

Check app/etc/env.php to ensure the session storage configuration is appropriate for your environment.

 

Magento Version Upgrade

Ensure that your Magento version is up-to-date. Newer Magento versions come with bug fixes and improvements that might resolve your issue.

 

 

Hope it helps !

If you find our reply helpful, please give us kudos.

 

A Leading Magento Development Agency That Delivers Powerful Results, Innovation, and Secure Digital Transformation.

 

WebDesk Solution Support Team

Get a Free Quote | | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789

 

 

Thank You,


WebDesk Solution Support Team
Get a Free Quote | Email | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789


Location: 150 King St. W. Toronto, ON M5H 1J9