magento - remove recently added items

magento - remove recently added items

August 15, 2026 · Illustrated author avatarBy Stefan Bogdanescu
magento - remove recently added items

How to Remove “Recently Added Items” from Magento Side Cart: A Less Destructive Approach

One of the most frequent requests we receive at LaravelCompany is how to remove the “Recently added items” section from the cart sidebar on the front page of a Magento store. While it’s possible to simply comment out or delete the relevant lines in your checkout/cart/sidebar.phtml file, this approach can lead to headaches down the line.

In this post, we’ll explore a less destructive method that allows you to easily toggle this feature on and off without permanently altering your core files. This technique involves using Magento’s built-in layout XML updates.

Understanding the Current Approach

The current manual approach involves commenting out or deleting approximately 20 lines of code in the checkout/cart/sidebar.phtml file:

<? // if(count($_items)): ?>
  <!-- <p class="block-subtitle"><? //echo $this->__('Recently added item(s)') ?></p> -->
   <!-- <ol id="cart-sidebar" class="mini-products-list"> -->
    <? // foreach($_items as $_item): ?>
        <? // echo $this->getItemHtml($_item) ?>
    <? // endforeach; ?>
   <!-- </ol> -->
   <!-- <script type="text/javascript">decorateList('cart-sidebar', 'none-recursive')</script> -->
<? // else: ?>
   <!-- <p class="empty"><? //echo $this->__('You have no items in your shopping cart.') ?></p> -->
<? // endif ?>

While this method is straightforward, it permanently modifies the core file. If you decide to restore the functionality later or need to update your Magento version, you’ll face challenges.

The Less Destructive Approach: Using Layout XML Updates

Magento allows you to override and modify the layout structure using XML updates. This technique provides a much cleaner solution that doesn’t require modifying the core files directly.

Here’s how to implement this:

  1. Create a new file named catalog.xml in your theme directory (e.g., app/design/frontend/your_package/your_theme/layout/catalog.xml).

  2. Add the following content to the newly created catalog.xml file:

<layout version="0.1.0">
    <default>
        <reference name="cart_sidebar">
            <!-- Remove the 'Recently added item(s)' section -->
            <remove name="cart_sidebar.recently_products" />
        </reference>
    </default>
</layout>
  1. Save and clear your cache (bin/magento cache:clean or php bin/magento cache:clean).

This XML update tells Magento to remove the “recently_products” block from the cart sidebar layout.

Why This Approach is Better

Using this method offers several advantages:

  • Future Proofing: This approach doesn’t modify core files, making it easier to update your Magento version or restore the functionality later.
  • Modularity: It keeps your modifications separate from the core codebase, making your theme more portable and maintainable.
  • Ease of Reversal: If you decide to reverse this change in the future, simply remove or comment out the relevant lines in the catalog.xml file.

Conclusion

While the manual approach of commenting out lines in the sidebar.phtml file is quick and dirty, it’s not a recommended practice for maintaining a healthy and upgrade-friendly Magento store. Using layout XML updates, as demonstrated above, provides a cleaner, less destructive way to remove the “Recently added items” section from your cart sidebar.

At LaravelCompany, we always advocate for keeping your core files intact and using Magento’s built-in features when possible. This approach not only respects the software structure but also saves you time and effort in the long run.

Don’t hesitate to explore more of our Magento development resources for additional tips and tricks on optimizing your e-commerce experience!

Checkout Catalog Themes JavaScript

Our network