How to remove Addresses tab from customer edit(form) page in admin panel Magento 2?
4 Answers
Create customer_account.xml
if does not exit at app/design/frontend/{ThemeVendorName}/{ThemeName}/Magento_Customer/layout/
and inside it adds below code:
<?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-account-navigation-address-link" remove="true" />
</body>
</page>
-
I want to remove it in the admin panel, not in the frontend. Let me edit my question. Feb 22, 2019 at 10:31
Hope you're still there to accept my answer. Unlike the others that could be removed by xml, build a plugin instead.
etc/adminhtml/di.xml
<type name="Magento\Customer\Ui\Component\Form\AddressFieldset">
<plugin name="long_customer_customer_address" type="Long\Customer\Plugin\Ui\Component\Form\AddressFieldset" sortOrder="10" disabled="false"/>
</type>
Plugin file
<?php
namespace Long\Customer\Plugin\Ui\Component\Form;
use Magento\Customer\Ui\Component\Form\AddressFieldset as AddressFieldsetParent;
class AddressFieldset
{
/**
* @param AddressFieldsetParent $subject
* @param $result
*
* @return bool
*/
public function afterIsComponentVisible(AddressFieldsetParent $subject, $result){
$result = false;
return $result;
}
}
app/code/[Vendor]/[MODULE]/view/adminhtml/layout/customer_index_edit.xml
Remove orders tab from admin customer edit
<?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="orders" remove="true" />
</body>
You can override below file and remove whole fieldset="address" tag or you can comment it.
File path.
vendor/magento/module-customer/view/base/ui_component/customer_form.xml
You can create your custom file in below directory path
YourVendorName/YourModuleName/view/base/ui_component/customer_form.xml
remove or comment fieldset="address"
Please up vote if it is helpful for you.
-
-
You must have to remove whole fieldset tag not only single line. Feb 22, 2019 at 11:31