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
If you are still stuck with the same error after implementing the above solution, please mention your doubts in the Comments section below. I’d be glad to help you out.
Do share the solution with the fellow developers via social media!