Remove Newsletter tabs from the Customer Edit page admin panel in Magento 2 using a layout XML file.
You can delete the newsletter tabs from the Admin panel Customer Edit page left sidebar section. The Tab displays the Subscribed information with the checkbox.
If Project doesn’t need to use newsletter functionality or admin can’t able to manage customer newsletter, You need to remove tabs from the admin panel.
Create a customer_index_edit.xml file at your module-level in adminhtml scope,
app/code/Jesadiya/Newsletter/view/adminhtml/layout/customer_index_edit.xml
Code Snippet,
<?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="customer_edit_tab_view"> <referenceBlock name="newsletter" remove="true" /> </referenceBlock> </body> </page>
customer_edit_tab_view is the Main Block to display all the information on the Customer Edit Page admin panel.
When you explore the file from, Magento_Newsletter/view/base/ui_component/customer_form.xml, you can find the block to display all the information on the Newsletter tab.
Use the newsletter name to remove it from the customer edit section.
Clear Cache and check the Customer Page.