Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DomPixie/8ff0aa75716ac6024b910be3ed40aa90 to your computer and use it in GitHub Desktop.
Save DomPixie/8ff0aa75716ac6024b910be3ed40aa90 to your computer and use it in GitHub Desktop.
Magento 2 Refresh customer cart local storage on button submit
require([
'jquery',
'Magento_Customer/js/customer-data'
], function ($,customerData) {
'use strict';
$(document).on('submit', function (event) {
if (event.target.method.match(/post/i)) {
customerData.initStorage();
customerData.invalidate(['cart']);
customerData.invalidate(['customer']);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment