always show My Account & Wish List user logged in or not
-
09-10-2020 - |
Question
Am new in magento 2 and also no experience in magento 1. I'm try to show My Account & Wish List links in top nav link in my custom theme (parent: Magento/luma ) like blank theme. I try with Magento/blank parent but still not show my account & wish list link. i try to add this script
app/design/frontend/Package/themename/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">
<referenceBlock name="register-link" />
<referenceBlock name="authorization-link" />
<referenceBlock name="wish-list-link" />
<referenceBlock name="my-account-link" />
</referenceBlock>
</body>
</page>
Solution
Copy default.xml in your theme
If you extend luma theme
app/design/frontend/Prince/test/Magento_Theme/layout/default.xml
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<!-- you can easly add New links with following code -->
<referenceBlock name="header.links">
<!-- Add Your Link Here -->
<block class="Magento\Framework\View\Element\Html\Link" name="contactus.link" after="register-link">
<arguments>
<argument name="label" xsi:type="string" translate="false">Contact Us</argument>
<argument name="path" xsi:type="string" translate="false">contact-us</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>
If you extend blank theme
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<!-- you can easly add New links with following code -->
<referenceBlock name="top.links">
<!-- Add your link here -->
<block class="Magento\Framework\View\Element\Html\Link" name="contactus.link" after="register-link">
<arguments>
<argument name="label" xsi:type="string" translate="false">Contact Us</argument>
<argument name="path" xsi:type="string" translate="false">contact-us</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange