In Magento 1.9 How to display mini-cart in top menu?

In Magento 1.9 How to display mini-cart in top menu?

July 29, 2026 · Illustrated author avatarBy Stefan Bogdanescu
In Magento 1.9 How to display mini-cart in top menu?

Displaying Magento Mini-Cart in Top Menu: A Comprehensive Guide

Welcome to our Magento development blog! Today, we’re going to tackle a common question from new Magento users - how to display the mini-cart functionality directly within your top menu. This will not only save space on your store but also provide an intuitive shopping experience for your customers.

Understanding the Mini-Cart Structure in Magento 1.9

Before we dive into the code, let’s understand what makes up a functional mini-cart in Magento. The core of it lies in the minicart.phtml template file located at:

app/design/frontend/base/default/template/checkout/cart/minicart.phtml

This template renders the list of items currently added to the cart using the core MVC structure.

Modifying Your Top Menu for Mini-Cart Integration

To integrate the mini-cart into your top menu, you’ll need to modify your custom theme’s top.links.phtml file. This is typically located in your custom theme folder under:

app/design/frontend/[Your-Theme]/[Package]/template/page/html/

Open this file and locate the <div class="minicart-wrapper"> section where the default mini-cart is displayed.

Embedding Mini-Cart in Top Menu: The Step-by-Step Approach

Step 1: Include the Mini-Cart Template

First, we need to include the minicart.phtml template inside our top menu. Add the following line after the <div class="top-links"> opening tag:

<?php echo $this->getChildHtml('minicart') ?>

Step 2: Remove the Default Mini-Cart

Since we’re moving the mini-cart to the top menu, we don’t need it in its default position anymore. Comment out or remove this line from your page/html/minicart.phtml file:

<div class="minicart-wrapper">

Step 3: Assigning the Mini-Cart to Top Menu

Now, let’s tell Magento to assign the mini-cart to our top menu block by editing the layout XML. Open your custom theme’s local.xml layout update file located in:

app/design/frontend/[Your-Theme]/[Package]/layout/

Find or add a new <reference name="top.links"> section and inside it, add the following code:

<reference name="top.links">
    <block type="checkout/cart_minicart" name="minicart" template="checkout/cart/minicart.phtml"/>
</reference>

While we’re at it, let’s enhance the user experience by adding some helpful links to our top menu. You can add a “Clear Cart” link for easy cleanup and a direct link to the shopping cart.

To add a clear cart link, update your top.links.phtml file as follows:

<div class="top-link-cart">
    <a href="<?php echo $this->getUrl('checkout/cart/clear') ?>"><?php echo $this->__('Clear Cart') ?></a>
</div>

To add a direct link, update the same file:

<div class="top-link-cart">
    <a href="<?php echo $this->getUrl('checkout/cart/index') ?>"><?php echo $this->__('Cart (0)') ?></a>
</div>

Conclusion: Integrating Mini-Cart for Superb User Experience

That’s it! By following these steps, you’ve successfully integrated the Magento mini-cart into your top menu, providing a seamless and intuitive shopping experience.

Remember, always backup your files before making changes. Also, consider using version control systems like Git to track modifications.

For more advanced customizations and best practices in Magento development, check out our comprehensive guides on Laravel Company’s Magento Blog.

This concludes our post. I hope this guide was clear and helpful for you! If you have any other questions or need further assistance, feel free to leave a comment below.

Happy coding!

Magento 1 Checkout Themes Customers

Our network