Previously, I had given the programmatic solution to add top link in Magento 2.
However, you may need to perform the reverse action, i.e., remove top link in Magento 2. There can be many reasons to do so. For example, you had added a link for testing purpose but now changed your mind. Or, you want to disable new registration temporarily. In cases when you want to change the labels of top links or override the default functionality, you can also use the below solution.
Method to Remove Top Link in Magento 2:
Create default.xml at Vendor/Extension/view/frontend/layout/ folder
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
<referenceBlock name="register-link" remove="true" /> <!--for Create Account Link-->
<referenceBlock name="authorization-link" remove="true" /> <!--for Sign In Link -->
<referenceBlock name="wish-list-link" remove="true" /> <!--for WishList Link-->
<referenceBlock name="my-account-link" remove="true" /> <!--for My Account Link-->
Implement the above code and remove top links in the Magento 2 store.
Efficiently manage the top links for an optimized and easy-to-shop frontend!
Use the Comments section below if you have any doubts on the topic. Also, let me know how the solution was useful to optimize your store frontend.
I’d be very grateful if you help share this helpful post on social media to fellow developers!
Get Weekly Updates
Never miss Magento tips, tricks, tutorials, and news.
Thank you for subscribing.
Something went wrong.