0

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.

asked Apr 15, 2023 at 6:18
2
  • try to add customerData.invalidate(sections); on above customerData.reload(sections, true); Commented 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. Commented Apr 17, 2023 at 5:22

1 Answer 1

2

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.

answered Apr 20, 2023 at 17:19

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.