Solved – “Your session has expired” On Clicking Add To Cart In Magento 2.3 Localhost

If you have been too much into Magento like me, you might have experienced an error that says “Your session has expired” on clicking add to cart in Magento 2.3 localhost.

This may happen when you have installed a fresh Magento 2.3 at local and trying test product functionality by adding to the cart.

To resolve the issue, try the below solution to get rid of the expired session error.

Solution For “Your Session Has Expired” On Clicking Add To Cart In Magento 2.3 Localhost:

Use 127.0.0.1 instead of localhost

UPDATE core_config_data SET value = 'http://127.0.0.1/mag233sample/' WHERE core_config_data.path = 'web/unsecure/base_url';
UPDATE core_config_data SET value = 'http://127.0.0.1/mag233sample/' WHERE core_config_data.path = 'web/secure/base_url';

“http://127.0.0.1/mag233sample/” is localhost homepage URL

Run the command:

php bin/magento cache:flush

That’s it.

Do share the solution with the fellow developers via social media!

Thanks.

Table of Contents