How to add a Logout link to the Customer Account Dashboard

To add a Logout link to the customer account dashboard you will need to change/create the layout file responsible for the customer account page.

That file is customer_account.xml and you should place it inside the Magento_Customer/layout folder in your custom theme with the following content:

# File app/design/frontend/<Theme_Vendor>/<Theme_Name>/Magento_Customer/layout/customer_account.xml

<?xml version="1.0"?> 
<page xmlns xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/ete/page_configuration.xsd"> 
      <referenceBlock name="customer_account_navigation"> 
          <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navagation-logout-link">
               <argument name="path" xsi:type="string">customer/account/logout</argument>
               <argument name="label" xsi:type="string">Logout</argument>

Leave a Reply

Your email address will not be published. Required fields are marked *