How to hide shopping cart sidebar when it is empty

Last modified by holylander on Wed, September 5, 2012 17:08
Source|Old Revisions  

Here is how you could hide the shopping cart side bar when it is empty:

1. Open: app/design/frontend/default/<your template>/template/checkout/cart/sidebar.phtml

2. Go to line 32 Look for

<div class="box base-mini mini-cart">

3. Add these lines right before that opening div tag

<?php $_cartQty = $this->getSummaryCount() ?>
<?php if ($_cartQty >0): ?>

4.Add this line to the bottom of the file

<?php endif ?>

That is it your are all set, the shopping cart will only show if user adds items to their shopping cart.

You could see it working here Koozies, just add an item and it will appear and once you remove it the sidebar will be gone...

_ EDIT _

Xogenics offers a free extension which enables this feature without having to dive into the code:

Hide Cart is a great little extension that enables users to hide the shopping cart block in case the cart is empty. You may also choose to hide the shopping cart block completely.

http://www.magentocommerce.com/magento-connect/xogenics/extension/8217/xogenics_hidecart




 

Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs