Add the following jquery in
app/design/frontend/your_theme/default/template/checkout/cart/minicart.phtml


<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('.container').hover(function() {
jQuery(this).children('#header-cart,.skip-cart').addClass("skip-active");
}, function() {
jQuery(this).children('#header-cart,.skip-cart').removeClass("skip-active");
});
});
</script>

minicart.phtml


<?php
$_cartQty = $this->getSummaryCount();
if(empty($_cartQty)) {
$_cartQty = 0;
}
?>
<div class="container">
<a href="#header-cart" class="skip-link skip-cart <?php if($_cartQty <= 0): ?> no-count<?php endif; ?>">
<span class="icon"></span>
<span class="label"><?php echo $this->__('Cart'); ?></span>
<span class="count"><?php echo $_cartQty; ?></span>
</a>

<div id="header-cart" class="block block-cart skip-content">
<?php echo $this->getChildHtml('minicart_content');?>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('.container').hover(function() {
jQuery(this).children('#header-cart,.skip-cart').addClass("skip-active");
}, function() {
jQuery(this).children('#header-cart,.skip-cart').removeClass("skip-active");
});
});
</script>

Categories: Magento

4 Comments

Luis Paulo Lohmann · July 1, 2015 at 5:25 pm

If you’re reading this, please notice that the code to open the minicart on click is already written in the app.js file. And that is the right place for you to edit the javascript and change that behaviour. Avoid att all costs unnecessary changes to the phtml code, SPECIALLY adding inline javascript to it.

    Sushant Vishwas · July 6, 2015 at 2:58 pm

    Thanks Dude

    san · November 23, 2016 at 3:26 pm

    show mini cart on mouse hover in magento2.1?

ana · February 9, 2017 at 7:28 pm

Hello! this code in the navigator Google Chrome mobile responsive is necessarily doubleclick for the cart, how to fix this?

Thank you!

Leave a Reply to ana Cancel reply

Avatar placeholder

Your email address will not be published. Required fields are marked *