Closed alexber88 closed 4 years ago
@alexber88, thank you for your report. We've acknowledged the issue and added to our backlog.
Working on it #MLAU18
Not able to reproduce on 2.2.2
@alexber88 are you loading your cart on the same HTTP / HTTPS socket as when you checked out? In my case, checkout is on HTTPS and when loading cart on HTTPS, the selecting shipping method and totals are showing correctly.
@btwq i'm using http.
The same issue on Magento 2.2.2 and 2.2.3
To quickly reproduce the issue you need to
Expected result: You see entered first name and last name
Actual result: All fields are blank
We have done a digging into the code, so
In Magento\Persistent\Observer\RefreshCustomerData::execute persistent extension clean the "mage-cache-sessid" cookie key.
This observer is called in another observer \Magento\Persistent\Observer\CheckExpirePersistentQuoteObserver::execute and the term
if ($this->_persistentData->isEnabled() &&
!$this->_persistentSession->isPersistent() &&
!$this->_customerSession->isLoggedIn() &&
$this->_checkoutSession->getQuoteId() &&
!$observer->getControllerAction() instanceof \Magento\Checkout\Controller\Onepage
// persistent session does not expire on onepage checkout page to not spoil customer group id
) {
is always TRUE if persistent shopping cart is enabled and you visit the website as a guest, so the "mage-cache-sessid" cookie key is always removed.
When the mage-cache-sessid is missing or is empty Magento remove all local storage data. Please see vendor/magento/module-customer/view/frontend/web/js/customer-data.js
invalidateCacheByCloseCookieSession = function () {
if (!$.cookieStorage.isSet('mage-cache-sessid')) {
$.cookieStorage.set('mage-cache-sessid', true);
storage.removeAll();
}
};
$this->_persistentSession->isPersistent() term return false when you is a guest beckouse \Magento\Persistent\Model\Session::setPersistentCookie never called for guest. It anly called for customer in vendor/magento/module-persistent/Observer/SynchronizePersistentOnLoginObserver.php
and
\Magento\Persistent\Model\Session::renewPersistentCookie is also called only for customer in vendor/magento/module-persistent/Observer/RenewCookieObserver.php
@magento-engcom-team give me 2.2-develop instance
Hi @therouv. Thank you for your request. I'm working on Magento 2.2-develop instance for you
Hi @therouv, here is your Magento instance.
Admin access: https://i-13690-2-2-develop.engcom.dev.magento.com/admin
Login: admin
Password: 123123q
Instance will be terminated in up to 3 hours.
I can't reproduce this issue on a vanilla 2.2-develop instance with the described steps. Seems to be fixed in the latest version.
I enabled guest checkout and persistent shopping cart in store configuration:
I added a category and product and then added the product to the cart. After I visited the checkout for the first time the values are empty (which is correct since I'm not logged in):
I then entered a firstname and lastname and hit the refresh button of my browser multiple times. After every time when the page rendered, the entered values were still present in the firstname and lastname field.
See recorded screencast of the followed steps here
Oh, it was tricky! I am still able to reproduce it on vanilla.
php --version
PHP 7.0.32-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Oct 1 2018 11:45:35) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.32-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies
with blackfire v1.18.0~linux-x64-non_zts70, https://blackfire.io, by SensioLabs
First,
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition magento2
bin/magento setup:install
bin/magento sampledata:deploy
So that it is the latest and the most vanilla magento I can imagine:
bin/magento --version
Magento CLI version 2.2.6
In order to fail transaction you need to use the following payment data: Credit card: 4000111111111115 Expires at: any date in future CVC: 123 Transaction amount: >2000.0 <3000 (transaction status depends on amount, we need failure in order to reproduce the bug)
See https://developers.braintreepayments.com/guides/credit-cards/testing-go-live/php
Shipping address information is still on place
I am also seeing this error on 2.2.6. I could see the issue once I had something in my basket and was not logged in. I could then see the XHR Network requests in the browser calling ?sections=directory-data&... ?sections=cart&... even though these were already in local storage.
After going through some code I can see the same thing as @magefan in that the backend code Magento\Persistent\Observer\execute() is deleting the cookie "mage-cache-sessid"
Then the frontend module-customer/view/frontend/web/js/customer-data.js is checking if that cookie is NOT set and then resets the cookie and removes everything from local storage.
invalidateCacheByCloseCookieSession = function () {
if (!$.cookieStorage.isSet('mage-cache-sessid')) {
$.cookieStorage.set('mage-cache-sessid', true);
console.log("invalidateCacheByCloseCookieSession - remove all storage")
storage.removeAll();
}
};
The backend will then clear this cookie again causing the FE to reset and clear storage - and so forth.
This issue only happens when persistent mode is enabled.
The backend observer gets from "persistent_session_expired" which is dispatched from Magento\Persistent\Observer\CheckExpirePersistentQuoteObserver and checks
Hope this helps.
I can confirm this is still in Magento 2.3.0 I don't understand the goal to force refresh "sections xhr call", this is a major performance issue. Not logged visitors keep "call xhr sections" on every page on the store, sometimes 3 calls per page.
Is the solution to disable "RefreshCustomerData" Observer ?
I have noticed the same bug in M2.3 with PHP7.2. I was logged in as a client in a demo environment in two browsers at the same time. After I returned from a lunch I refreshed the page and in firefox an empty collection was returned on all pages. So I went to the same account in Internet Explorer and there on the same account the collections became empty as well after a refresh. (FPC on a customer group?) On a second testing account that is using a different customer group in Google Chrome the collections remained the same (not empty). I noticed this was occurring after I enabled the persistent shopping cart and stopped after I disabled it again.
We faced with the same problem.
It is already fixed in 2.3: https://github.com/magento/magento2/blob/2.3.0/app/code/Magento/Persistent/Observer/CheckExpirePersistentQuoteObserver.php
BUT if you, as guest user, go to checkout, fill in the shipping data. Than you decided to buy another product and you go to some PDP, return back to checkout and your address becomes empty.
I'm seeing the same issue, it seemed much easier to reproduce on Magento Commerce version. Seems like the easy solution is to disable "RefreshCustomerData"observer as @kpitn mentions. But the original commit message "My Wishlist control contains incorrect info after longterm session is over" doesn't give much insight into the original reason why this observer was added. I don't like just removing things, but I'd rather have the postcode/selected shipping method be correct than some hard-to-reproduce wishlist issue.
I have upgraded the magento version from 2.2.5 to 2.2.8 and in 2.2.5 persistent shopping cart was disable so in 2.2.5 my custom code of storing some dynamic data(data source was some url) in LocalStorage with help of sections.xml was working good but it is not working with 2.2.8 but in 2.2.8 it works with logged-in user.
What can be the possible solution.
Hi @engcom-Echo. Thank you for working on this issue. Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:
[ ] 1. Add/Edit Component: XXXXX
label(s) to the ticket, indicating the components it may be related to.
[ ] 2. Verify that the issue is reproducible on 2.4-develop
branchDetails
- Add the comment @magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
[ ] 3. If the issue is not relevant or is not reproducible any more, feel free to close it.
Hi @engcom-Bravo. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
[ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).Details
If the issue has a valid description, the label Issue: Format is valid
will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid
appears.
[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description
label to the issue by yourself.
[ ] 3. Add Component: XXXXX
label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.4-develop
branchDetails
- Add the comment @magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
[ ] 5. Add label Issue: Confirmed
once verification is complete.
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hello @alexber88 We have rechecked this issue on Magento 2.4-develop, and it seems to be fixed. Please see the attachment below. We Enable Persistence and try to reproduce this by refreshing the Shipping page and adding one more Product ti the Cart
As for the comment https://github.com/magento/magento2/issues/13690#issuecomment-429316214 This is also not reproducible. We have configured the Braintree and tried to reproduce with the described steps. The Shipping info didn't disappear
We are closing this issue. If you still experience the same problem on Magento 2.4-develop, please feel free to comment, reopen or create new ticket according to the Issue reporting guidelines . Thank you for collaboration.
Preconditions
Steps to reproduce
Expected result
Actual result
Additional information