How can I create the mini cart loader overlay when customer deleting an item?
I've found js files but I can't figure out where should I put code lines to activate and disable loader overlay.
Thank you in advance!
In the js /magento/vendor/magento/module-checkout/view/frontend/web/js/sidebar.js
on Events Click, you will find the function _removeItem
which calls _ajax
function.
In the _ajax
function you will find beforeSend
and complete
methods which you can use to enable and disable loader overlay.
For instance,
/** @inheritdoc */
beforeSend: function () {
elem.attr('disabled', 'disabled');
$("#loader").show();
},
/** @inheritdoc */
complete: function () {
elem.attr('disabled', null);
setTimeout(function() {
$("#loader").hide();
}, 3000);
}
I hope this helps!