How to remove unwanted items from Magento 1.x shopping cart landing page

I decided to write this post, because it’s quite a challenge to do this for Magento start-up Front-end developers.

First of all, I advise to find magento extension for shopping cart that already have this option. You can use this link and find “cart” with ctrl+f. Pretty neat, huh?  You can also search on official Magento Connect site.

What comes in mind is Instant Cart by Mageworx, Ajax Cart Pro by aheadWorks and Ajax Shopping Cart by Amasty (I’m not affiliate to any of this).

Anyway, if you don’t want to use and test any extensions or you couldn’t find one with needed option, here is one way to do it (another way is try to do it via XML).

This is quite tricky since Magento using html table for outputting data elements in shopping cart landing page. For example, if they used html div tags, it’s really easy and we just need to add a css class and then need to add “display: none; ” or “visibility: hidden” css property to remove unwanted items. So unfortunately we can’t use css to hide or remove.

So only solution is, modifying pthml files. You can refer following image to know how Magento output values in the shopping cart landing page.

how to remove magento shopping cart items

Figure 1: Magento output values in shopping cart landing page

To remove table headers, just open following phtml file in your Magento installation and uncomment table data tags as you wish.

Step 1

app\design\frontend\YOUR-THEME\default\template\checkout\cart.phtml

<?php //if ($this->helper('wishlist')->isAllowInCart()) : ?>
<!-- Removed table date for wishlist-->
<!--
<td class="a-center">
 <?php //if ($isVisibleProduct): ?>
 <a href="<?php //echo $this->helper('wishlist')->getMoveFromCartUrl($_item->getId()); ?>" class="link-wishlist use-ajax"><?php //echo $this->__('Move'); ?></a>
 <?php //endif ?>
</td>
-->
<?php //endif ?>

And then open following file and remove html table data tags.

Step 2

\app\design\frontend\YOUR-THEME\default\template\checkout\cart\item\default.phtml

<?php //if ($this->helper('wishlist')->isAllowInCart()) : ?>
 <!-- Removed table date for wishlist-->
 <!--
 <td class="a-center">
 <?php //if ($isVisibleProduct): ?>
 <a href="<?php //echo $this->helper('wishlist')->getMoveFromCartUrl($_item->getId()); ?>" class="link-wishlist use-ajax"><?php //echo $this->__('Move'); ?></a>
 <?php //endif ?>
 </td>
 -->
 <?php //endif ?>

By commenting out php and html lines as above, you will be able to remove “Move to wishlist” link from Magento shopping cart landing page.

Hope this post help for you. Please comment your ideas.