سؤال

I want to add loading effect before ajax call of remove product from the mini cart.

Right now when I remove the product from the cart, It takes 4-5 seconds to delete but user cannot identify whether the process is going on or not.

I tried to find JS file for the responsible code but not able to find it.

Does anyone have an idea which JS file contains code to call AJAX to remove the product from the cart?

enter image description here

هل كانت مفيدة؟

المحلول

You can check below file

/vendor/magento/module-checkout/view/frontend/web/js/sidebar.js

it has events on click, can find something like _removeItem

If you are using any custom theme, it may be there under Magento_Checkout modules directory

نصائح أخرى

I override below file in my custom theme

/vendor/magento/module-checkout/view/frontend/web/js/sidebar.js

In place of _removeitem I put in _ajax method.

I show loading effect in beforeSend of that method and hide in complete

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top