0

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!

1 Answer 1

1

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!

1
  • You are awesome!
    – Aleksey
    Commented Jun 12, 2020 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.