Skip to main content

Magento 2.4.5 customer-data.js not initiating in Custom theme js file

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.

 

REF: https://magento.stackexchange.com/a/366304/31830

1 change: 0 additions & 1 deletionapp/code/Magento/Theme/view/base/requirejs-config.js
Copied!
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ var config = {
'jquery/validate': 'jquery/jquery.validate',
'jquery/file-uploader': 'jquery/fileUploader/jquery.fileuploader',
'prototype': 'legacy-build.min',
'jquery/jquery.cookie': 'js-cookie/cookie-wrapper',
'jquery/jquery-storageapi': 'js-storage/storage-wrapper',
'text': 'mage/requirejs/text',
'domReady': 'requirejs/domReady',
11 changes: 11 additions & 0 deletionslib/web/jquery/jquery.cookie.js
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

define([
'jquery',
'js-cookie/cookie-wrapper'
], function () {

});
2 changes: 1 addition & 1 deletionlib/web/js-storage/js.storage.js
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
(function (factory) {
var registeredInModuleLoader = false;
if (typeof define === 'function' && define.amd) {
define(['jquery', 'js-cookie/cookie-wrapper'], factory);
define(['jquery', 'jquery/jquery.cookie'], factory);
registeredInModuleLoader = true;
}
if (typeof exports === 'object') {

 

app/code/Magento/Theme/view/base/requirejs-config.js
Copied!
Original file line number Diff line number Diff line change
@@ -69,7 +69,6 @@ var config = {
'jquery/validate': 'jquery/jquery.validate',
'jquery/file-uploader': 'jquery/fileUploader/jquery.fileuploader',
'prototype': 'legacy-build.min',
- 'jquery/jquery.cookie': 'js-cookie/cookie-wrapper',
'jquery/jquery-storageapi': 'js-storage/storage-wrapper',
'text': 'mage/requirejs/text',
'domReady': 'requirejs/domReady',---------

------------

lib/web/jquery/jquery.cookie.js
Copied!
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

define([
'jquery',
'js-cookie/cookie-wrapper'
], function () {

});

---------------

 


lib/web/js-storage/js.storage.js
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
(function (factory) {
var registeredInModuleLoader = false;
if (typeof define === 'function' && define.amd) {
- define(['jquery', 'js-cookie/cookie-wrapper'], factory);
+ define(['jquery', 'jquery/jquery.cookie'], factory);
registeredInModuleLoader = true;
}
if (typeof exports === 'object') {