cancel
Showing results for 
Search instead for 
Did you mean: 

Your session has expired" error when adding products to cart from category page in Magento 2

Your session has expired" error when adding products to cart from category page in Magento 2

I am facing an issue in my Magento 2.4.2 installation. Every time I try to add products to the cart from the category page, I receive the error message "Your session has expired". However, I am able to add products to the cart without any issues from other parts of the store.

I have tried to resolve the issue by following these steps:

  1. I updated the base URLs in the core_config_data table using the Magento CLI commands:

php bin/magento setup:store-config:set --base-url="http://tu-url-enmascarada.com/"
php bin/magento setup:store-config:set --base-url-secure="https://tu-url-enmascarada.com/"

2.I cleared the Magento cache using the command:

php bin/magento cache:clean

However, the issue persists and I am unable to add products to the cart from the product page.

I appreciate any help or suggestions you can provide. Thank you in advance!

1 REPLY 1

Re: Your session has expired" error when adding products to cart from category page in Magento

If you are using a localhost, use 127.0.0.1 instead of localhost in the url. And run the command 

php bin/magento cache:flush

These issues were widely faced by many people in Magento 2.3 but with the update of 2.4, according to the developers these issues were resolved. You can still try this. If this doesn't work, clean your cache and open in incognito.

Hope this works for you.