Magento 2.2.2 above Open minicart when item is added, without page refresh

Navigate to vendor/magento/Magento_Checkout/view/web/js/view/minicart.js
Under initialize: function, you will see
Replace the function with this code

php bin/magento cache:clean

$('[data-block="minicart"]').on('contentLoading', function (event) {
            addToCartCalls++;
            self.isLoading(true);
            $('[data-block="minicart"]').on('contentUpdated', function ()  {
            $('[data-block="minicart"]').find('[data-role="dropdownDialog"]').dropdownDialog("open");

            setTimeout(function() {
            $('[data-block="minicart"]').find('[data-role="dropdownDialog"]').dropdownDialog("close");
        }, 4000);
        });

Comments

Popular posts from this blog

TypeScrpt basics

font-face HTTPS issue fixes