6

I have added below given xml code in default.xml, sign out is coming two times , 1 is in dropdown and another one is in top links, i want to remove signout from top links in magento 2.1 please check the code.

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="header.panel">
            <block class="Magento\Cms\Block\Block" name="free_shipping">
            <arguments>
            <argument name="block_id" xsi:type="string">free_shipping</argument>
            </arguments>
            </block>
            <block class="Magento\Framework\View\Element\Html\Links" name="header.links">
                <arguments>
                    <argument name="css_class" xsi:type="string">header links</argument>
                </arguments>
            </block>            
        </referenceContainer>
        <referenceBlock name="logo">
            <arguments>
                <argument name="logo_img_width" xsi:type="number">148</argument>
                <argument name="logo_img_height" xsi:type="number">43</argument>
            </arguments>
        </referenceBlock>
        <referenceBlock  name="header.links">
            <block class="Magento\Framework\View\Element\Html\Link" name="storelocate.link" after="-">
                    <arguments>
                        <argument name="label" xsi:type="string" translate="true">Store Locator</argument>
                        <argument name="path" xsi:type="string" translate="false">store-locator</argument>
                        <argument name="class" xsi:type="string">store_locator</argument>
                    </arguments>
            </block>

            <block class="Magento\Framework\View\Element\Html\Link" name="comcom.link" after="about-us">
                <arguments>
                    <argument name="label" xsi:type="string" translate="true">Community Commerce</argument>
                    <argument name="path" xsi:type="string" translate="false">community-commerce</argument>
                    <argument name="class" xsi:type="string">community_commerece</argument>
                </arguments>
            </block>
            <block class="Magento\Framework\View\Element\Html\Link" name="story.link" after="comunity-commerce">
                <arguments>
                    <argument name="label" xsi:type="string" translate="true">Our Story</argument>
                    <argument name="path" xsi:type="string" translate="false">our-story</argument>
                    <argument name="class" xsi:type="string">our_story</argument>
                </arguments>
            </block>
            <block class="Magento\Framework\View\Element\Html\Link" name="ingred.link" after="our-story">
                <arguments>
                    <argument name="label" xsi:type="string" translate="true">Our Ingredients</argument>
                    <argument name="path" xsi:type="string" translate="false">our-ingredients</argument>
                    <argument name="class" xsi:type="string">our_ingredients</argument>
                </arguments>
            </block>         
            <referenceBlock name="skip_to_content" remove="true" />
        </referenceBlock>
        <!-- <referenceContainer name="header.panel">                
            <container name="header-links-nxt" as="header links" label="Header links" htmlTag="ul" htmlClass="header links secondary" after="-">

            </container>
        </referenceContainer> -->


        <referenceContainer name="footer-container">
            <container name="footer-content-customised" htmlTag="div" htmlClass="footer-content-customised" before="-">
                <container name="footer-top" label="Footer Top" htmlTag="div" htmlClass="footer-top page-main sheamoisture_footer_contents" before="-">
                    <block class="Magento\Cms\Block\Block" name="footer-content-top">
                        <arguments>
                            <argument name="block_id" xsi:type="string">footer-content-top</argument>
                        </arguments>
                    </block>
                </container>
                <container name="footer-bottom" as="footer content" label="Footer Bottom" htmlTag="div" htmlClass="footer content" after="-">
                    <block class="Magento\Framework\View\Element\Html\Links" name="footer_links">
                        <arguments>
                            <argument name="css_class" xsi:type="string">footer links</argument>
                        </arguments>
                    </block>
                </container>
                <referenceBlock name="footer_links">
                    <block class="Magento\Framework\View\Element\Html\Link\Current" name="FAQ">
                        <arguments>
                            <argument name="label" xsi:type="string">FAQ</argument>
                            <argument name="path" xsi:type="string">faq</argument>
                        </arguments>
                    </block>
                    <block class="Magento\Framework\View\Element\Html\Link\Current" name="Privacy Policy">
                        <arguments>
                            <argument name="label" xsi:type="string">Privacy Policy</argument>
                            <argument name="path" xsi:type="string">privacy-policy</argument>
                        </arguments>
                    </block>
                    <block class="Magento\Framework\View\Element\Html\Link\Current" name="Terms of Use">
                        <arguments>
                            <argument name="label" xsi:type="string">Terms of Use</argument>
                            <argument name="path" xsi:type="string">terms-of-use</argument>
                        </arguments>
                    </block>
                    <block class="Magento\Framework\View\Element\Html\Link\Current" name="Returns Policy">
                        <arguments>
                            <argument name="label" xsi:type="string">Return Policy</argument>
                            <argument name="path" xsi:type="string">return-policy</argument>
                        </arguments>
                    </block>            
                </referenceBlock>
            </container>            
        </referenceContainer>
        <move element="footer-bottom" destination="footer-content-customised" />

<!-- <move element="minicart" destination="header.links" before="-"/>
        <move element="top.search" destination="header.links" after="-"/> -->

        <move element="catalog-search-advanced-link" destination="footer_links" before="-"/>
        <referenceBlock name="search-term-popular-link" remove="true"/>
    <referenceBlock name="points.balance" remove="true"/>


        <referenceBlock name="privacy-policy-link" remove="true"/>
        <referenceBlock name="form.subscribe" remove="true"/>
        <referenceBlock name="catalog-search-advanced-link" remove="true"/>
        <referenceBlock name="sales-guest-form-link" remove="true"/>
        <referenceBlock name="report.bugs" remove="true"/>
        <move element="copyright" destination="footer-bottom"/>
        <referenceBlock name="contact-us-link" remove="true"/>
    </body>
</page>

4 Answers 4

4

You have to keep below code inside your themes default.xml file,

After keep below code, Sign in and Sign out link are remove from top links.

  <?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="authorization-link" remove="true"/>
         </body>
    </page>
7
  • actually sign in link i want in top links, once customer sign in, signout is coming in drop down and in out side of dropdown its in top links header. i have to remove another one which is coming outside of dropdown. Oct 27, 2016 at 11:29
  • plz share your screenshot Oct 27, 2016 at 11:38
  • am unable to share screenshot. can u please register in this given link and check please. dev.i3lsundial.com Oct 27, 2016 at 12:32
  • You can try with, <referenceBlock name="header.links"> <referenceBlock name="authorization-link" remove="true"/> </referenceBlock> in default.xml file Oct 27, 2016 at 12:39
  • plz let me know after check Oct 27, 2016 at 12:39
4

In default.xml write this code:

<?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="authorization-link-login" remove="true"/>
     </body>
</page>
1
  • Which removes the signin link too.
    – Ramya
    Feb 12, 2020 at 9:33
1

Override Authorization.link block file from vendor/magento/module-customer/Block/Account to your module and change from: `

public function getLabel()
    {
        return $this->isLoggedIn() ? __('Sign Out') : __('Sign In');
    }

to

public function getLabel()
{
    return $this->isLoggedIn() ? __('') : __('Sign In');
}

Hope it helps

1
  • This suggestion didn't answer correctly the question. Aug 4, 2021 at 4:59
0

You can remove the authorization link but that would also remove the sign in link.

Another way to go about this is to use something like this https://github.com/TheFrankman/magento2-customhandles to add the customer_logged_in and customer_logged_out handles to Magento 2

Then create a customer_logged_in.xml with the removal of the authorization-link-login (removing authorization-link would also remove the account icon dropdown)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.