I am building a website and my client doesn't want the cart icon to appear on the home page. On every other page it should appear, just not on the home page. How can I tell it to not display on a particular page? I'm guessing I can use CSS 'display: none;' but i'm not sure how to indicate only to do that on the main page?

Just to confirm, the cart is setup in the 'header' of my page.

Not sure that you need it, but here is my code:


<div class="header-minicart">

    <a class="skip-link skip-cart no-count" data-target-element="#header-cart" href="https://URL/checkout/cart/">

    <span class="icon"></span>
    <span class="label"></span>
    <span class="count"></span>

<div id="header-cart" class="block block-cart skip-content"></div>



.skip-cart .icon {
    background-position: 0px -95px;
    display: inline-block;
    width: 30px;
    vertical-align: middle;
    height: 30px;
    background-image: url("../images/icon_sprite.png");
    background-repeat: no-repeat;
    text-indent: -9999px;
    float: right;
    margin-top: 0px;
    margin-right: 30px;

Thanks in advance!!

3 Answers 3


Yes..you can hide in home page only. in magento, body tag contains different classes according to the page.

for you, cms-index-index and cms-home is good to go.

use as .cms-index-index .skip-cart .icon { display: none; }

Above is just a sample.. You could use the mentioned classes to hide in homepage. Good luck mate.

  • Awesome, thank you!! This worked exactly how I wanted it to!
    – itsk2015
    May 29, 2015 at 5:32
  • But i strongly recommend you to check the option mentioned by Pradeep Sanku also. Might use for this or in future. Good LUCK May 29, 2015 at 5:38

Try to use the following code in the header.phtml file of your theme

In your header.phtml file search for the following code

<div class="header-minicart">
    <?php echo $this->getChildHtml('minicart_head'); ?>

and replace with my code which checking wheather am on the home page or not

<?php $is_homepage = Mage::getBlockSingleton('page/html_header')->getIsHomePage(); ?>
<?php if(!$is_homepage): ?>
    <div class="header-minicart">
        <?php echo $this->getChildHtml('minicart_head'); ?>
<?php endif; ?>
  • Thank you! 'The Magento Kid's' option above worked so I didn't end up needing this, but I will definitely try it for other things that may come up. Much appreciated!
    – itsk2015
    May 29, 2015 at 5:33

You should really be doing this with magento's layout files. Every page will have a unique layout handle as well as some default ones so you should be able specifically target pages. If you look in app/design/frontend/base/default/layout/checkout.xml in the default handles you should see <reference name="top.links"> <block type="checkout/links" name="checkout_cart_link"> <action method="addCartLink"></action> <action method="addCheckoutLink"></action> </block> </reference>

This outputs the links in the top.links region on every page. To remove this open up your local.xml app/design/frontend/{theme}/{package}/layout/local.xml if you're using the normal cms homepage you should just need to add the following:

<cms_index_index> <remove name="checkout_cart_link" /> </cms_index_index>

more info:

http://www.classyllama.com/blog/editing-magentos-top-links-the-better-way http://www.mcnab.co/blog/e-commerce/magento/magento-remove-all-toplinks-via-local-xml/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.