---
title: "Remove xml export in admin grid Magento 2"
url: "https://dolphinwebsolution.com/remove-xml-export-in-admin-grid-magento-2"
date: "2021-10-25T14:00:11+05:30"
modified: "2023-08-25T09:11:52+05:30"
author:
  name: "Jigar Patel"
categories:
  - "Magento"
word_count: 545
reading_time: "3 min read"
summary: "Magento 2 ExportButton component implements the ability to export grid data to the specified data format (CSV, XML, and so on). Ui component has a feature to export collection data in CSV and XML f..."
description: "Magento 2 ExportButton component implements the ability to export grid data to the specified data format (CSV, XML, and so on). Ui component has a feature to..."
keywords: "remove XML export in admin grid,remove XML export in magento,Magento 2 remove XML export,remove XML export in admin grid in magento, Magento"
language: "en"
schema_type: "Article"
related_posts:
  - title: "Tips to Boost Speed of Magento Website"
    url: "https://dolphinwebsolution.com/blog/tips-to-boost-speed-of-magento-website/"
  - title: "How to Add Customer Attribute Programmatically in Magento 2"
    url: "https://dolphinwebsolution.com/how-to-add-customer-attribute-in-magento-2"
  - title: "How To Add Or Create Slide-out(Sliding) ,Modal Windows Panels in Magento 2"
    url: "https://dolphinwebsolution.com/how-to-add-or-create-slide-outsliding-modal-windows-panels-in-magento-2"
---

# Remove xml export in admin grid Magento 2

_Published: October 25, 2021_  
_Author: Jigar Patel_  

![](https://dolphinwebsolution.com/wp-content/uploads/2021/10/Remove-xml-export-in-admin-grid-Magento-2-1024x536.png)

Magento 2 ExportButton component implements the ability to export grid data to the specified data format (CSV, XML, and so on). Ui component has a feature to export collection data in CSV and XML format. By default, it exports complete collection with CSV and XML formate.

Ui Component is a combination of **XML declaration** that specifies the component’s configuration settings and inner structure. **JavaScript class** inherited from one of the Magento JavaScript framework UI components base classes (such as UIElement, UIClass or UICollection) **Related template(s).**

Recently, one of our clients was willing to get remove XML export in admin grid so, he can easily deliver a customized admin grid fit their requirements without changing core Magento functionalities. After spending some time coding, finally, we have successfully delivered a smile to a client’s face.

so if you want to export remove the XML formate data export then going to explain how you can do this.

Let’s explore two steps below!

Read this: [Category Import/Export for Magento 2](https://dolphinwebsolution.com/shop/category-import-export-for-magento.html)

#### **Step 1: C**omponent layout file

Add code to layout component file **custom\_listing.xml** in **app/code/Vendor/Module/view/adminhtml/ui\_component** folder with the following code.

```
-------------
<exportButton name="export_button" class="Vendor\Module\Component\ExportButton">
    <argument name="data" xsi:type="array">
        <item name="config" xsi:type="array">
            <item name="options_custom" xsi:type="array">
                <item name="cvs" xsi:type="array">
                    <item name="value" xsi:type="string">csv</item>
                    <item name="label" xsi:type="string" translate="true">CSV</item>
                    <item name="url" xsi:type="string">vendor_module/product/gridtocsv</item>
                </item>
            </item>
        </item>
    </argument>
</exportButton>
-----------
```

**ExportButton component** configuration options :

- **additionalParams:** List of additional parameters added to each performed request.
- **options:** List of available formats in which the table’s data can be exported.
- **template :** Path to the component’s [.html template.](https://developer.adobe.com/commerce/frontend-core/guide/templates/override/)
- **checked:** The checked data format to export.

**ExportOption interface** :

- **label:** Option’s label. This is a required field.
- **URL:** Path to the controller that will process the request. This is a required field.
- **value:** Identifier of the export option. This is a required field.

#### Step 2: Create Class File
Create class file **ExportButton.php** in **app/code/Vendor/Module/Component** folder with the following code.

```
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Vendor\Module\Component;

/**
 * Class ExportButton
 */
class ExportButton extends \Magento\Ui\Component\ExportButton
{
    /**
     * @return void
     */
    public function prepare()
    {
        $context = $this->getContext();
        $config = $this->getData('config');
        if (isset($config['options'])) {
            $options = [];
            foreach ($config['options'] as $option) {
                /*Removed xml from here*/
                if($option['value'] != 'xml'){
                    $additionalParams = $this->getAdditionalParams($config, $context);
                    $option['url'] = $this->urlBuilder->getUrl($option['url'], $additionalParams);
                    $options[] = $option;
                }
            }
            $config['options'] = $options;
            $this->setData('config', $config);
        }
        parent::prepare();
    }
}
```

**$option\[‘value’\]** return to export file oprion.[if value is XML](https://dolphinwebsolution.com/magento-2-add-ifconfig-in-override-block-xml) then by pass the options.

Like to read this: [Add Buttons into Ui Component Form Magento 2](https://dolphinwebsolution.com/add-buttons-into-ui-component-form-magento-2)

**Result :**

![AI Integration in Magento: Benefits, Use Cases and Business Impact](https://dolphinwebsolution.com/wp-content/uploads/2021/10/remove-xml-e1634895784814.png)

I Hope, This instruction will be helpful for you.

If you have any difficulties regarding this blog, do consider them posting in the Comments section below!

I’m here to help.

**Thank you!**


---

_View the original post at: [https://dolphinwebsolution.com/remove-xml-export-in-admin-grid-magento-2](https://dolphinwebsolution.com/remove-xml-export-in-admin-grid-magento-2)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-08-26 06:53:24 UTC_  
