1

Can anyone let me know, How an alert box getting delete an item popup, from minicart: location below:

line 71:

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

Where defined the alert for this, Please let me know the location of alert. in magento2.

1 Answer 1

6

I you are still looking for an answer, the modal confirmation is created in vendor/magento/module-checkout/view/frontend/web/js/sidebar.js and it's a parameter named confirm:

        /**
         * @param {jQuery.Event} event
         */
        events['click ' + this.options.button.remove] =  function (event) {
            event.stopPropagation();
            confirm({
                content: self.options.confirmMessage,
                actions: {
                    /** @inheritdoc */
                    confirm: function () {
                        self._removeItem($(event.currentTarget));
                    },

                    /** @inheritdoc */
                    always: function (e) {
                        e.stopImmediatePropagation();
                    }
                }
            });
        };
1
  • In template/minicart/item/default.html this code create delete button <div class="secondary"> <a href="#" data-bind="attr: {'data-cart-item': item_id, title: $t('Remove item')}" class="action delete"> <span data-bind="i18n: 'Remove'"></span> </a> </div> in this code where is define to call click event in sidebar.js
    – HaFiz Umer
    Commented Oct 28, 2019 at 12:23

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.