Magento 2 Cart – Find Magento 2 Cart Buttons Action

cartmagento2

I'm using magento 2 , and I need to find the cart close button and go to checkout button actions , and edit it , but I can't find the right files for that, does anyone knows where to find them ?

Best Answer

Go to file path, vendor/magento/module-checkout/view/frontend/web/js/view/minicart.js

check below part for close button html like,

<button type="button" id="btn-minicart-close" class="action close" data-action="close" data-bind="attr: { title: $t('Close') }" title="Close">
        <span><!-- ko i18n: 'Close' --><span>Close</span><!-- /ko --></span>
    </button>

For close button html in minicart above display we can find data-action="close" from js file.

closeSidebar: function() {
            var minicart = $('[data-block="minicart"]');
            minicart.on('click', '[data-action="close"]', function(event) {
                event.stopPropagation();
                minicart.find('[data-role="dropdownDialog"]').dropdownDialog("close");
            });
            return true;
        }

Here list of url for checkout, update button, login url, remove button

 "url": {
            "checkout": window.checkout.checkoutUrl,
            "update": window.checkout.updateItemQtyUrl,
            "remove": window.checkout.removeItemUrl,
            "loginUrl": window.checkout.customerLoginUrl,
            "isRedirectRequired": window.checkout.isRedirectRequired
        },
        "button": {
            "checkout": "#top-cart-btn-checkout",
            "remove": "#mini-cart a.action.delete",
            "close": "#btn-minicart-close"
        }
Related Topic