After placing an order I was unable to remove the "You added Test Product to your shopping cart." message. The message also appeared on the order success page and even reappears when I close the browser and open the site again - see screenshot
I have a similar problem. Current version is 2.0.7. Whenever I add a product to cart the success message comes up and keeps showing anywhere I go in cart until going to one step checkout. Also, if I add or remove to compare same thing happens...success message will not go away.
You added xxxx to your shopping cart.
You removed product xxxxx from the comparison list.
This appeared to be some kind of glitch as I have tried more orders and the issue has disappeared.
The issue appears to be intermitrent. I have added an item to the cart today and the message appeared again on every page.
To allow us research the issue, please, provide description according to the template and
very accurate steps for reproduce.
Version: 2.0.7
1) Click add to cart on home page for any product that shows
2) click on category OR click on another product nothing shows
3) click a home page link and the success message occurs again
4) then I click on category page or product page again and now the success message keeps following me everywhere and won't go away.
I cleared chrome browser cache and tried again click add to cart directly from a category page and could not make the problem appear however when I go to home page and click add to cart it appears. The same problem appears in Firefox but does not follow me around in category or product pages...only keeps showing on home page.
Also in both Firefox and Chrome if I leave the session alone for a few minutes it seems to disappear until I start adding to cart again.
Do you use some widget on the home page which contains a product?
Nothing. You can see a screenshot of the homepage above.
@bondimedical3 I don't see any product on your home page)
I use productlist widget on home page
Here's a similar thread:
https://github.com/magento/magento2/issues/5530
someone said that saying yes to cookie restriction mode fixed the problem but it did not work for me
@bondimedical3
According to contributor guide, tickets without response for two weeks should be closed.
Please feel free to reopen if it's needed.
This issue has not been resolved. Have just done a new installation of 2.1.1 and everything is working except for this - see screenshot.
Could someone reply to this bug?
I'm working on a custom theme inheriting from blank, and I'm also getting this bug on the frontend. I'm on version 2.1.2.
@mtb2112 it is fixed in commit https://github.com/magento/magento2/commit/9515999f75fc728084079b8aae7ccc784cd8c1f3, just see other closed ticket https://github.com/magento/magento2/issues/5530.
I tried the fix and it seems work correctly.
Thanks @LucScu. That resolved the issue for me.
This has STILL not been fixed. Upgraded to 2.1.3 today and the bug is still showing intermittently. I have looked at the fixes:
Internal ticket for develop branch - MAGETWO-54866, fix is in commit 9515999
Internal ticker for branch 2.1 - MAGETWO-56956, fix is in commit 39b35ec
Internal ticket for branch 2.0 - MAGETWO-56955, fix is in commit 592ded2
but none of these work.
Hi all,
I made some tests and I tracked the bug down to a single method call in js.
Mage: 2.0.7
Symptoms:
How to reproduce the bug (in devmode):
storage.remove(sectionName);
Problematic code:
File: mage/vendor/magento/module-customer/view/frontend/web/js/customer-data.js
Code:
ko.extenders.disposableCustomerData = function(target, sectionName) {
var sectionDataIds, newSectionDataIds = {};
target.subscribe(function(newValue) {
setTimeout(function(){
storage.remove(sectionName); // <-- comment out this line
sectionDataIds = $.cookieStorage.get('section_data_ids') || {};
_.each(sectionDataIds, function (data, name) {
if (name != sectionName) {
newSectionDataIds[name] = data;
}
});
$.cookieStorage.set('section_data_ids', newSectionDataIds);
}, 3000); // <-- comment out this line
});
return target;
};
whenever the call to storage.remove(sectionName)
fails, the browser is stuck in the state of showing the messages (I guess they're persisted in local storage). Prevent this call once and the message will stick around.
What I did was remove the timeout so the code is called immediately to reduce the chance of a messages sticking around (the 3s timeout is like asking for it)....
I'm not 100% sure what goes wrong but 1) i could reproduce the bug, 2) removing the timeout cured the problem for me in firefox.
Maybe a magento frontend dev can shed some light as to what this is supposed to do exactly.
Hi I managed to make it work by adding some more condition introduced in the commit iivashchenko committed on 17 Aug 2016.
You need to modify the file located in pub/static/frontend/Magento/luma/fr_FR/Magento_Theme/js/view/messages.js
as follow:
/**
* Copyright 漏 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'jquery',
'uiComponent',
'Magento_Customer/js/customer-data',
'jquery/jquery-storageapi'
], function ($, Component, customerData) {
'use strict';
return Component.extend({
defaults: {
cookieMessages: [],
messages: []
},
initialize: function () {
this._super();
this.cookieMessages = $.cookieStorage.get('mage-messages');
this.messages = customerData.get('messages').extend({
disposableCustomerData: 'messages'
});
var mess = this.messages();
// Force to clean obsolete messages
if (!_.isEmpty(mess.messages) || !mess.hasOwnProperty('messages')) { // <-- force clean if messages property does not exist
customerData.set('messages', {});
}
$.cookieStorage.setConf({path: '/', expires: -1}).set('mage-messages', null);
}
});
});
Hope this helps.
Temporary solution (saves his time and nerves):
vendor/magento/module-theme/view/frontend/web/js/view/messages.js
file:[magento@server webhome]# cp vendor/magento/module-theme/view/frontend/web/js/view/messages.js \ app/design/frontend/<VendorName>/<theme>/Magento_Theme/web/js/view/messages.js
$.cookieStorage.set('mage-messages', '');
$(document).ready(function() { $.cookieStorage.set('mage-messages', ''); });
My proposal before good fix of task quene after AJAX request:
Add "domReady!"
to list of defined method. I add setTimeout to be sure that messages are cleared from cookie.
Main problem: Messages from AJAX are delivered after messages.js initialize method so they stay random time on screen.
same issue in magento 2.1.8 :(
any solution ?
Is there any update on this?
from https://github.com/magento/magento2/issues/10107#issue-239735117
copy vendor/magento/module-theme/view/frontend/web/js/view/messages.js to your theme file, and at the end of initialize function add:
$(window).on('beforeunload', function () {
$.cookieStorage.set('mage-messages', '');
});
Most helpful comment
This issue has not been resolved. Have just done a new installation of 2.1.1 and everything is working except for this - see screenshot.
