cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a custom link in customer account navigation visible to certain customers only?

How to make a custom link in customer account navigation visible to certain customers only?

How can I make a custom link in customer account navigation visible to certain customers only?

Example: I have a link labeled "Ticket management". If a user clicks on that he is redirected to a page where he can view and edit tickets. I want only display this link to customers that have a certain custom variable set.

Can I specify this in customer_account.xml or somewhere else?

This is my customer_account.xml:

    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <body>
            <referenceBlock name="customer_account_navigation">
                <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-tickets-link">
                    <arguments>
                        <argument name="path" xsi:type="string">ticket_module/index/display</argument>
                        <argument name="label" xsi:type="string">Tickets</argument>
                    </arguments>
                </block>
            </referenceBlock>
        </body>
    </page>