Site icon MageComp Blog

How to Add Sign Out Tab in Customer Account in Magento 2?

How to Add Sign Out Tab in Customer Account in Magento 2

Hello Magento Friends,

In this blog, we will explain How to Add Sign Out Tab in Customer Account in Magento 2.

The “Sign Out” tab is a useful feature to include in the customer account section as it allows logged-in customers to easily log out from their accounts. Without a clear and accessible sign-out option, customers might have difficulties finding the logout functionality, leading to a potentially frustrating user experience.

By adding the “Log  Out” tab, you improve the usability of your Magento 2 store, making it more user-friendly and intuitive for customers. Providing a smooth and hassle-free experience for your customers can contribute to higher customer satisfaction and encourage repeat business on your Magento 2 eCommerce business.

Let’s see How to Add Sign Out Tab in Customer Account in Magento 2.

Steps to Add Sign Out Tab in Customer Account in Magento 2:

Step 1: Create a customer_account.xml file inside the theme folder.

\app\design\frontend\Vendor\Theme\Magento_Customer\layout

Then add the code as given below

<?xml version="1.0"?> 
<page layout="2columns-left" xmlns xsi="http://wwww3.org/2001/XMLSchema-instance" 
  xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/ete/page_configuration.xsd"> 
    <body>
        <referenceBlock name="customer_account_navigation"> 
            <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navagation-signout-link">
                <arguments>
                    <argument name="path" xsi:type="string">customer/account/logout</argument>
                    <argument name="label" xsi:type="string" translate="true">Sign Out</argument>
                </arguments>
            </block>
        </referenceBlock>
    </body>
</page>

Output:

Visit your Magento 2 store’s front end, login to a customer account, and navigate to the customer account section. You should see the “Sign Out” tab in the account navigation links. Clicking on it will log the customer out of their account.

Conclusion:

Adding a simple yet effective “Sign Out” tab to the customer account section in Magento 2 will elevate your online store’s user experience. To further enhance the customer experience, Add Custom Tab in Customer Account in Magento 2.

Share the tutorial with Magento developers and store owners to help them enhance the user experience. Stay in touch with us for more Magento 2 solutions.

Happy Coding!

Exit mobile version