I want to open the header cart when a product is added to the cart on my Magento store, by adding the class display:block; to my header cart div after the page is re-loaded.

I use the default cart method, that the page refresh and the product is added to the cart.

My header cart got the div <div class="cart-wrapper" id="mini-header-cart">

How can I achieve this?


I am almost there using the success message element, but I do not want to check the length of the success message, but if the success message contains a add to cart phrase. Any ideas how to change my code?


<script type="text/javascript">
                    if ($('.messages .success-msg').length){
                     var screen_width = $(window).width();
                    if (screen_width > 780) {$('.cart-container .cart-wrapper').css('display','block');}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.