0

I want to change the URL of the "create An account" link that is on the top right of the site. I want the link to instead of being customer/account/create/ I want it to be customer/account/login

I believe I have to edit the default xml file that is

app/design/frontend/Smartwave/porto_child/Magento_Customer/layout

here is the file just not sure how to edit it

<?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="header.links">
 <block class="Magento\Customer\Block\Account\Customer" name="customer" template="account/customer.phtml" before="-"/>
 <block class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link-login" template="account/link/authorization.phtml"/>
 </referenceBlock>
 <block class="Magento\Theme\Block\Html\Header" name="header" as="header">
 <arguments>
 <argument name="show_part" xsi:type="string">welcome</argument>
 </arguments>
 </block>
 <move element="header" destination="header.links" before="-"/>
 <move element="register-link" destination="header.links"/>
 <move element="top.links" destination="customer"/>
 <move element="authorization-link" destination="top.links" after="-"/>
 </body>
</page>
Himanshu
1,76618 silver badges34 bronze badges
asked Dec 11, 2018 at 18:39
0

2 Answers 2

3

Change class of block register-link to Magento\Framework\View\Element\Html\Link

Now you can pass the parameter path to change link

So your final default.xml should look like this:

app/design/frontend/Smartwave/porto_child/Magento_Customer/layout/default.xml

<?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="top.links">
 <block class="Magento\Framework\View\Element\Html\Link" name="register-link">
 <arguments>
 <argument name="label" xsi:type="string" translate="true">Create an Account</argument>
 <argument name="path" xsi:type="string" translate="true">customer/account/login</argument>
 </arguments>
 </block>
 </referenceBlock>
 ....
 ....
 </body>
</page>
answered Dec 12, 2018 at 5:34
1

You can remove existing Create an Account link and add a custom link. You need to edit following file:

mage2Root/app/design/frontend/{Package}/{theme}/Magento_Theme/layout/default.xml

Add below code inside body tag:

<referenceBlock name="register-link" remove="true"/>
<referenceBlock name="top.links">
 <block class="Magento\Framework\View\Element\Html\Link" name="add-new-header-link">
 <arguments>
 <argument name="label" xsi:type="string" translate="true">Create an Account@</argument>
 <argument name="path" xsi:type="string" translate="true">customer/account/login</argument>
 </arguments>
 </block>
</referenceBlock>

If needed you can use after,before for adjust position of link.

Hope above will help!

answered Dec 12, 2018 at 5:07
2
  • 2
    We don't need to remove existing register-link link Commented Dec 12, 2018 at 5:34
  • Yes, you are right! great.. Commented Dec 13, 2018 at 3:41

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.