Removing links from top menu using local.xml

Removing links from top menu using local.xml

August 17, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Removing links from top menu using local.xml

Removing Links from the Top Menu Using local.xml

As an experienced Magento developer, I often encounter situations where clients need to customize their store’s top menu. One common request is to remove specific links from the top menu without touching the core files directly. In this post, we’ll guide you through removing a link from your top menu using only your local.xml file.

Understanding Your Current Setup

You’re working with Magento 1.6 and have discovered that the checkout.xml file contains references to the top links block:

<reference name="top.links">
    <block type="checkout/links" name="checkout_cart_link">
        <action method="addCartLink"/>
        <action method="addCheckoutLink"/>
    </block>
</reference>

This code adds both a cart link and a checkout link to your top menu.

Your goal is to remove only the addCartLink from your top menu. While you could directly edit the core file, it’s better to keep your customizations separate using the local.xml file for easier maintenance and updates.

You’ve tried using the <remove> directive:

<layout>
    <default>
        <remove name="top.links" />
    </default>
</layout>

This successfully removes the entire top links block, but it’s not the solution you’re looking for. You want to remove only one specific link.

To remove a single link from your top menu in Magento 1.6, you need to target the specific block within the top.links container:

<layout>
    <default>
        <update handle="checkout_top_links" />
        <reference name="top.links">
            <action method="removeLinkByName" name="checkout_cart_link"/>
        </reference>
    </default>
</layout>

Let’s break down this code:

  1. <update handle="checkout_top_links">: This line loads the top links block definition from the checkout.xml file.
  2. <reference name="top.links">: This references the entire top.links container, which is a child of your page layout.
  3. <action method="removeLinkByName" name="checkout_cart_link">: This action calls the removeLinkByName() method on the top.links block to remove the link with the name checkout_cart_link.

Conclusion

As a Magento developer, keeping your customizations within the local.xml file is essential for maintaining a clean and upgrade-friendly codebase. By utilizing the removeLinkByName() method in conjunction with the <update> directive, you can easily remove specific links from your top menu without touching the core files.

Remember to always backup your data before making significant changes to your Magento installation. If you need further assistance or want to explore more advanced customizations, feel free to explore our comprehensive guides on Laravel Company.

Happy coding!

Magento 1 Checkout Themes Configuration

Our network