0

I need to override the variable cacheKey in my custom js

var cacheKey = 'checkout-data',

        /**
         * @param {Object} data
         */
        saveData = function (data) {
            storage.set(cacheKey, data);
        },

        /**
         * @return {*}
         */
        getData = function () {
            var data = storage.get(cacheKey)();

            if ($.isEmptyObject(data)) {
                // data = $.initNamespaceStorage('mage-cache-storage').localStorage.get(cacheKey);
                 //if ($.isEmptyObject(data)) {
                data = {
                    'selectedShippingAddress': null, //Selected shipping address pulled from persistence storage
                    'shippingAddressFromData': null, //Shipping address pulled from persistence storage
                    'newCustomerShippingAddress': null, //Shipping address pulled from persistence storage for customer
                    'selectedShippingRate': null, //Shipping rate pulled from persistence storage
                    'selectedPaymentMethod': null, //Payment method pulled from persistence storage
                    'selectedBillingAddress': null, //Selected billing address pulled from persistence storage
                    'billingAddressFromData': null, //Billing address pulled from persistence storage
                    'newCustomerBillingAddress': null //Billing address pulled from persistence storage for new customer
                };
                saveData(data);
                 //}
            }

            return data;
        };

Which present in vendor/magento/module-checkout/view/frontend/web/js/checkout-data.js

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.