Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.1.11] Add to cart, try to checkout, cart is empty but mini-cart has items. #13427

Closed
aeu opened this issue Jan 30, 2018 · 16 comments
Closed
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release

Comments

@aeu
Copy link

aeu commented Jan 30, 2018

Issue

We have been getting reports from users saying that they added product to cart, tried to checkout, but when they go to the cart, the cart was empty, but the mini-cart still showed products.

We have been getting customer complaints about this issue in every release of Magento 2 we have used since October, up to and including our current implementation which is 2.1.11.

This has obviously been a nightmare to debug, but we have figured out how to reproduce it 100%, in Luma.

Preconditions

Dedicated server,
Magento 2.1.11.
CentOS 7.3.
PHP 7.
MariaDB.
Double Redis (session and cache).
Images on a CDN.

Steps to reproduce

  1. Add product to cart
  2. Click on cart
  3. Click on checkout button multiple times before the checkout page has loaded. At least two clicks are necessary.
  4. You will now be on a cart page page that says your cart is empty but your minicart will still have content.

Actual result

The user will be directed to a cart page saying there are no items in the cart, but the mini-cart will still have contents.

Expected result

The cart should have items in it.

Misc

I believe that this is probably related to the "Hit refresh multiple times fast in checkout and your cart will be empty" bug edit which can be referenced here - #12362

Fix

We added some client-side code to disable the "checkout" button after it was clicked, which solves this issue. This obviously does not resolve the fundamental problem (double refresh on checkout page clears cart) but it should be done anyway if for no other reason than to reduce server load. We can create a pull request for this if needed.

screen shot 2018-01-25 at 9 56 10 pm

@magento-engcom-team magento-engcom-team added Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed labels Jan 30, 2018
@magento-engcom-team
Copy link
Contributor

@aeu, thank you for your report.
We've acknowledged the issue and added to our backlog.

@magento-engcom-team magento-engcom-team added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release labels Jan 31, 2018
@wenpingguo
Copy link

I can reproduce this in Magento 2.2 too.
see video record https://monosnap.com/file/3nG4CTflRD4qD6QusZAeskxRKzybEj

@elioermini
Copy link
Member

elioermini commented Feb 28, 2018

We are having the same issues on 2.1.11 Commerce with Redis for session storage.

@bilabong
Copy link

bilabong commented Mar 8, 2018

Try to disable the FPC cache i have the same issue i think the checkout page has been cached when it was empty

@allisonlawrencels
Copy link

What is the status on this issue? We see it also and it is a huge issue for an ecommerce platform.

@elioermini
Copy link
Member

We are on 2.1.12 with composer so we temporarily (till we will find an official fix for 2.1.x) replaced \Magento\Framework\Session\SessionManager of Magento 2.1.10 https://github.com/magento/magento2/blob/2.1.10/lib/internal/Magento/Framework/Session/SessionManager.php which hasn't such issues by placing it one folder Lib/Framework/Session of our module.
We did the override in the main composer.json of the project inside the "autoload" node:

"psr-4": {
      "Magento\\Framework\\Session\\": "vendor/yourvendor/yourmodule/Lib/Framework/Session"
    }
"exclude-from-classmap": [
      "vendor/magento/framework/Session/SessionManager.php"
    ],

That is solving for now.

Otherwise a simpler fix without composer can be by placing the same SessionManager of 2.1.10 in your own lib/internal/Magento/Session folder

@allisonlawrencels
Copy link

@elioermini For what it's worth, I did not have luck with reverting the core code. I believe it is related to using PHP 7 - the fix I eventually was successful with is here: #12362 (comment)

Looking at the 2.2.3-develop branch, it seems that the Magento team is trying out the reverting solution as well, but I don't think that is going to be the solution here.

As someone pointed out in the linked thread, it would be nice to know specifically what risk Magento is trying to mitigate with the regenerate_session_id() call when going to checkout, as it is tempting to just remove that line altogether.

@aeu
Copy link
Author

aeu commented Mar 21, 2018

@allisonlawrencels Thanks for linking that other issue, that was a very interesting read. We are experiencing the exact same thing described in that thread - if you go to checkout, hit refresh a few times quickly and then the cart is empty.

I'll take a look at the solution that acetronaut posted and see if we can get that working here, we are currently on 2.1.12.

@elioermini
Copy link
Member

elioermini commented Mar 21, 2018

@allisonlawrencels exactly see my comment in #12362 we found out as well after a while the same fix you referenced but I forgot to amend it here. It is also solving this issue #4301 the only change in addition to #12362#issuecomment-373318974 I added in start() is $this->renewCookie($sid); after $this->validator->validate($this);

@ishakhsuvarov
Copy link
Contributor

@aeu This issue duplicates #12362
Closing. Please continue further tracking and discussion in mentioned ticket.
Thank you.

@magento-engcom-team
Copy link
Contributor

Hi @aeu. Thank you for your report.
The issue has been fixed in #14428 by @adrian-martinez-interactiv4 in 2.2-develop branch
Related commit(s):

The fix will be available with the upcoming 2.2.5 release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label May 12, 2018
@magento-engcom-team
Copy link
Contributor

Hi @aeu. Thank you for your report.
The issue has been fixed in #14429 by @adrian-martinez-interactiv4 in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.0 release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label May 12, 2018
@aeu
Copy link
Author

aeu commented May 22, 2018

I see that this is fixed in 2.3.x and 2.2.x, is there any chance of a fix in the next 2.1.x update as well?

@nmallepally
Copy link

nmallepally commented May 31, 2018

same issue on 2.1.12, cart is empty.
It happens when people clicked twice on the checkout button and the cart is empty but mini cart has items.

bordeo pushed a commit to Hevelop/magento2-patches that referenced this issue Jul 5, 2018
@apedicdev
Copy link
Contributor

I'm on 2.2.6 and I can still replicate the issue.

@anthonynewman
Copy link

Replicated on 2.2.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release
Projects
None yet
Development

No branches or pull requests