I have a function of ajax add to cart in below file and doing section reload. below code is in app/design/frontend/MyThemeNS/Mytheme/web/js/custom.js (just mentioning sample for understanding.)
require([
'jquery',
'mage/url',
'Magento_Customer/js/customer-data',
], function (,ドル url, customerData) {
....
ajax call function {
on success : {
.....
var sections = ['cart'];
customerData.reload(sections, true);
}
}
......
}
File : Magento_Customer/js/customer-data is not initiating. upon more debugging i found in chain of js libirary dependency initialising the last file lib/web/js-storage/storage-wrapper.js is containing 'js-storage/js.storage' file which is not initialising.
i checked the magento2 release 2.4.5 and saw this.
julien-maurel/js-storage instead of jQuery Strograe libraries
is this magento bug or any other way i can do section reload after ajax add to cart in my custom theme custom function.
i am stuck and not able to find solution. can someone support if known any such issue.
-
try to add customerData.invalidate(sections); on above customerData.reload(sections, true);Harish kuril– Harish kuril2023年04月16日 16:20:17 +00:00Commented Apr 16, 2023 at 16:20
-
on page load, 'Magento_Customer/js/customer-data' itself not initializing, due to that.my custom js itself not working. if i remove 'Magento_Customer/js/customer-data' then my custom js works, but unable to reload sections.Nits– Nits2023年04月17日 05:22:03 +00:00Commented Apr 17, 2023 at 5:22
1 Answer 1
There is a issue 2.4.5 with cookies and storage dependency. here is the patch need to apply. https://github.com/magento/magento2/issues/35913 this solves my problem.
Explore related questions
See similar questions with these tags.