Edit Magento Local Cache Storage Offline (Magento2)
Edit Magento Local Cache Storage Offline (Magento2)
Sometimes we might need to change something in the Local storage of Magento , the local storage is saved in this key ("mage-cache-storage")
I will put now an example to edit the selected shipping address in the checkout shipping section
<script>
require([
'uiComponent',
'jquery',
'Magento_Customer/js/customer-data',
'ko',
],function(Component, $, customerData,ko){
jQuery(document).ready(function() {
var address_id = 200;
var customData = customerData.get("checkout-data")();
customData.selectedShippingAddress = "customer-address"+address_id;
customerData.set("checkout-data", customData);
var customData = customerData.get("checkout-data")();
});
});
</script>
in the above example we changed the selected address to be the address ID = 200