How to disable the dropdown in the minicart?

I had a customer that wanted to remove the minicart dropdown and take the visitor directly to the cart page when clicking the cart icon.

This can be implemented by overriding the dropdown javascript module via mixin. First create a requirejs-config.js under your theme folder. You can add it inside the Magento_Checkout folder.

So, create file Theme_Folder/Theme_Name/Magento_Checkout/requirejs-config.js with the following content:

var config = {
    config: {
        mixins: {
            'mage/dropdown': {
                'Magento_Checkout/js/dropdown-mixin': true
            }
        }
    }
};

Then, create file Theme_Folder/Theme_Name/Magento_Checkout/web/js/dropdown-mixin.js with content:

define([
    'jquery'
], function($){
    return function(){
        $.widget('mage.dropdownDialog', $.mage.dropdownDialog, {
            open:function(){
                var $cartLink = $('div.minicart-wrapper a.showcart');
                
                window.location.href = $cartLink.attr("href");
            }
        });

        return $.mage.dropdownDialog;
    };
});

Clear cache and enjoy 🙂

Leave a Reply

Your email address will not be published.