Magento2 - How to remove the side navigation bar only in my account page?
-
11-04-2021 - |
Question
I need to remove the side bar only in My Account
page.
I had removed the side bar in Magento_Customer > Layout > customer_account.xml
but it removes from all the pages like (my address page,view orders page).
Code:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Customer My Account (All Pages)" design_abstraction="custom">
<head>
<title>My Accounts</title>
</head>
<body>
<referenceBlock name="sidebar.main.account_nav" remove="true"/>
</body>
Thanks in advance.
La solution
Please try to create this file
customer_account_index.xml
and add below line in that XML and clear Magento cache and check
<referenceBlock name="sidebar.main.account_nav" remove="true"/>
UPDATE :
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
</page>
Here you can see layout="1column"
in above content (You can use 2columns-left
, 2columns-right
, or your custom layout name here). It will change layout of your customer account page.
Hope this will help you!
Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange