0

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

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

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.

  • Sign In link disappeared after adding that code. Please suggest. – Soeb Safi Jun 19 '17 at 8:58
  • remove the first line code.. – aravind Nov 24 '17 at 9:11
0

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" />
  • This is not what he was asking at all. – Mike Sheward May 12 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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