1

I want to move the sign in link inside the header container after the minicart.

Please refer the image below.

enter image description here

As you can see in the image i have pointed it out where it should go.

Now, Some brief information about what i have done.

I have removed the header-wrapper by placing below code in default.xml

<referenceBlock name="header-wrapper" remove="true" />

Then, i have added a custom block where i have created my own custom header like shown in the image, by placing below code in default.xml

<referenceContainer name="header.container">
<block class="Magento\Framework\View\Element\Template" name="custom-header" as="custom-header" template="Magento_Theme::html/customheader.phtml"  after="header.panel.wrapper" />
</referenceContainer>

Then, i moved all elements into by own custom block by placing below code in default.xml

<move element="minicart" destination="custom-header"/>
<move element="top.search" destination="custom-header"/>
<move element="logo" as="logo" destination="custom-header"/>

Now the problem, and things i have tried to solve this.

I want to move sign in link to my own custom-header block. To do this i have tried below things.

By placing below code in default.xml

<move element="authorization.link" destination="custom-header"/>
<move element="authorization-link-login" destination="custom-header" />

Also by placing this code in default.xml

<referenceContainer name="custom-header">
  <container name="sign-in-div" htmlTag="div" htmlClass="signin-wrap" after="logo">
    <block class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link-login" template="Magento_Theme::account/link/authorization.phtml" />
  </container>
</referenceContainer>

Please suggest what i am doing wrong here.

Any help would be deeply appreciated.

4 Answers 4

7

In my previous experience with one of my client same (near to) requirement.

Header links needed before minicart without default message, so I'm sharing my experience matching your's requirement.

Link(s) on right side of minicart.

In your theme folder add below code in below file :

Magento_Customer/layout/default.xml

or

Magento_Theme/layout/default.xml

1. Move Sign-In Link next to minicart

<!-- move minicart next to search block -->
<move element="minicart" destination="header-wrapper" after="top.search"/>


<!-- move sign-in link  next to  minicart block -->
<move element="authorization-link-login" destination="header-wrapper" after="minicart"/>

2. Move All top Header Links next to minicart

<!-- header default welcome message if want to remove -->
<referenceBlock name="header" remove="true" />

<!-- Keep minicart next to search block -->
<move element="minicart" destination="header-wrapper" after="top.search"/>

<!-- Move top All Header Links next to minicart -->
<move element="header.links" destination="header-wrapper" after="minicart"/>

Note : LESS

/* 
Magento default css of float:right for minicart needs to be removed, if we want keep 
links on the right side.
Pt 1. is not mandatory but good to remove 
*/
.minicart-wrapper {   
     float: right; // need to remove float right
} 
2
  • @kahaiya. its working but Welcome User msg isnt getting displayed Commented Mar 2, 2020 at 4:04
  • @SairajGadekar <referenceBlock name="header" remove="true" /> is responsible to remove welcome message change attribute value remove="true" to remove="false", hope you will get your requested output, let me know for further help. Commented Mar 2, 2020 at 10:01
2

Add below code in default.xml

<move element="authorization-link-login" destination="custom-header" />

Let me know if you have any issue with this code.

3
  • Sign In link disappeared after adding that code. Please suggest.
    – Soeb Safi
    Commented Jun 19, 2017 at 8:58
  • remove the first line code..
    – aravind
    Commented Nov 24, 2017 at 9:11
  • Regard the same issue, Any help thanks snipboard.io/OYKzFh.jpg @Suresh Chikani
    – zus
    Commented Dec 5, 2020 at 12:11
0

You should add below code in default.xml

To remove signout from dropdown

<referenceBlock name="authorization-link" remove="true" />

If you want to remove signin signout button from header refer

<referenceBlock name="authorization-link-login" remove="true" />
-1

app/design/frontend/[vendor-name]/[theme-name]/Magento_Theme/layout/default.xml

To remove create an account link

<referenceBlock name="register-link" remove="true" /> 

To remove sign-in link

<referenceBlock Name ="authorization-link-login" remove ="true" />
1
  • This is not what he was asking at all. Commented May 12, 2019 at 19:20

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.