3

How to remove Addresses tab from customer edit(form) page in admin panel Magento 2?

2
  • what did you try? Feb 22, 2019 at 10:23
  • What I have tried so far is removing address fieldset in customer_form.xml and unlinking js/edit/tab/addresses.js
    – mighty_hk
    Feb 22, 2019 at 10:32

4 Answers 4

0

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>
1
  • I want to remove it in the admin panel, not in the frontend. Let me edit my question.
    – mighty_hk
    Feb 22, 2019 at 10:31
0

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;
    }
}
0

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>
-1

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.

2
  • Tried it, It only removes the form inside the tab, not the tab.
    – mighty_hk
    Feb 22, 2019 at 11:24
  • You must have to remove whole fieldset tag not only single line. Feb 22, 2019 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.