4


I am new in magento, I am creating website in magento 2.3 and I have installed FreeGo theme in my magento website. But

when i click on product's add to cart then it's giving me error--> Your session has expired.

I have google it a lot but didn't find any solution.


Here is the screenshot:

enter image description here
How can i get rid of this and product can add to cart? Please help me

Update: enter image description here

4
  • You can try to create a virtual domain name.
    – MichaelHa
    Commented Oct 2, 2019 at 9:28
  • what is your url ?please update in question Commented Oct 2, 2019 at 9:31
  • @SavanPatel It's in my localhost, http://localhost/zain/accessories/ Commented Oct 2, 2019 at 9:32
  • @MichaelHa virtual domain, how? Commented Oct 2, 2019 at 9:32

4 Answers 4

7

use 127.0.0.1 instead of localhost.

UPDATE `core_config_data` SET `value` = 'http://127.0.0.1/zain/accessories/' WHERE `core_config_data`.`path` = 'web/unsecure/base_url';

UPDATE `core_config_data` SET `value` = 'http://127.0.0.1/zain/accessories/' WHERE `core_config_data`.`path` = 'web/secure/base_url';

http://127.0.0.1/zain/accessories/ in this write your frontend url (home page url) what you have

after that run command in your terminal

php bin/magento cache:clean
17
  • where should i put this code? Commented Oct 2, 2019 at 9:36
  • run code in your database Commented Oct 2, 2019 at 9:37
  • I am using Phpmyadmin, so magento database, or in parent for all? Commented Oct 2, 2019 at 9:38
  • what is home page url (frontend url) this one localhost/zain ? Commented Oct 2, 2019 at 9:39
  • No, It's http://localhost/zain/accessories/ accessories folder is my magento website Commented Oct 2, 2019 at 9:40
1

You also can try to set correct domain in path web/cookie/cookie_domain in core_config_data table. (it's domain name, so no http(s):// and no / at end)

0

In case if you don't work in local than it must be your SSL issue. Do active SSL and then open the site with https and then try to add a product in cart. This will fix your problem for sure.

0

The solution for Magento ≥ 2.3.7:

bin/magento config:set system/security/max_session_size_storefront 0
bin/magento cache:clean

mage2.pro/t/6364

Another message for the same error is «Session size of <…> exceeded allowed session max size of <…>»

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.