Categories: Magento 2 Tutorials

Remove and Add Links in Magento 2 Footer

Footer is an important section of any ecommerce store. It is the last section of the store pages, and thus the last chance to convince the visitors to stay on the store and buy more. I have seen queries on several Magento forums about how to edit links and add new links in the footer of Magento 2 stores. So today, I am going to teach you how to remove links and add new links in the footer of Magento 2 stores. As always, when customizing Magento 2 stores, it is highly recommended that you create a custom module to ensure that the core files remain untouched.

Steps to Follow

Create a Custom Module

Create module.xml in app/code/Magenticians/Mymodule/etc and paste the following code in it:
<?xml version="1.0"?>
            <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
            <module name="Magenticians_Mymodule" setup_version="1.0.1"></module>
</config>
Create registration.php in app/code/Magenticians/Mymodule and paste the following code in it:
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Magenticians_Mymodule',
    __DIR__
);

Remove Link(s) and Add New Link(s) to the Magento 2 Footer

Suppose you wish to remove the Privacy Policy link and want to add Create an Account link in Magento footer. Create default.xml file in app/code/Magenticians/Mymodule/view/frontend/layout. To remove Privacy Policy link from Magento 2 footer, you need to add the following code in the  layout file:
<referenceBlock name="privacy-policy-link" remove="true"/>
Here are some link blocks you could easily remove:
  • Privacy and Cookie Policy: privacy-policy-link
  • Search Terms: search-term-popular-link
  • Contact Us: contact-us-link
  • Advanced Search: catalog-search-advanced-link
  • Orders and Returns: sales-guest-form-link
To add Create an Account link in Magento 2 footer, you need to add the following code in layout file:
<referenceBlock name="footer_links">
   <block class="Magento\Framework\View\Element\Html\Link\Current" name="custom-footer-link">
     <arguments>
       <argument name="label" xsi:type="string">Create Account</argument>
       <argument name="path" xsi:type="string">customer/account/create/</argument>
      </arguments>
   </block>
</referenceBlock>
In the code above, I have added the Create an Account link in Magento 2 footer according to the scenario. The final default.xml file will look like this:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="privacy-policy-link" remove="true"/>
       <referenceBlock name="footer_links">
         <block class="Magento\Framework\View\Element\Html\Link\Current" name="custom-footer-link">
             <arguments>
                 <argument name="label" xsi:type="string">Create Account</argument>
                 <argument name="path" xsi:type="string">customer/account/create/</argument>
             </arguments>
         </block>
     </referenceBlock>
</body>
</page>

Run CLI Commands

Launch the SSH terminal and connect to your store. Go to the root directory of your store and run the following commands:
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
php bin/magento cache:clean
php bin/magento cache:flush
Go to the store and you will see the result:

Final Words

You can now easily edit footer of your Magento 2 store. The process is simple and allows you to remove and add links in Magento 2 footer to fit your store marketing strategy. As always, if you need help, just drop a comment and I will get back to you.  
Syed Muneeb Ul Hasan

Syed Muneeb Ul Hasan is an expert in PHP and Magento, he prefers to educate users in implementing and learning Magento. When not working, he loves to watch cricket.

View Comments

  • Thank you for your writings.

    This doesn't tell how to totally customize the footer. How to add like 4 blocks of links in footer? As for someone coming from Joomla!, it's kinda hard to find my way around Magento.

Share
Published by
Syed Muneeb Ul Hasan

Recent Posts

Building Employee Trust and Dedication – A Complete Guide

In the highly competitive modern workplace, trust, and employee loyalty are crucial factors for long-term… Read More

3 months ago

12 Winning Strategies for Small Businesses Marketing

In the ever-evolving world of small business developing and implementing effective marketing strategies is critical to… Read More

3 months ago

Top 10 App Development Companies in Dubai 2024

With one of the highest internet penetration rates, the UAE has set out to revolutionize… Read More

3 months ago

Transforming Industries: How Amazons GPT44X is Revolutionizing AI Technology

Artificial Intelligence (AI) has been continually evolving, leading to remarkable advancements in various industries. Among… Read More

8 months ago

Top Magento 2 Extensions for 2023

Extensions, extensions and lots of extensions. We all love extensions, don’t we? After all, extensions… Read More

11 months ago

Unleashing the Power of Software Testing: Cooperating with a Testing Firm

Software quality is crucial to a firm's success across industries in the quickly changing digital… Read More

11 months ago