0

I want add new button near Add Product button in grid product in backend.

enter image description here

3

You can add new button there using UI Component file. Try to create below product_listing.xml file in your custom module.

app/code/Vendor/Module/view/adminhtml/ui_component/product_listing.xml

Content for this file is..

<?xml version="1.0" encoding="UTF-8"?>
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <argument name="data" xsi:type="array">
        <item name="buttons" xsi:type="array">
            <item name="new_button" xsi:type="array">
                <item name="name" xsi:type="string">new_button</item>
                <item name="label" xsi:type="string" translate="true">New Button</item>
                <item name="class" xsi:type="string">secondary</item>
                <item name="url" xsi:type="string">*/*/new</item>
            </item>
        </item>
    </argument>
</listing>

Run below commands :

php bin/magento cache:clean
php bin/magento cache:flush

Output :

enter image description here

Hope this will help you! ;-)

| improve this answer | |
  • 1
    It work fine. Thank you so much! – David Duong May 20 at 7:17
  • 1
    @DavidDuong, Welcome Buddy! :-) – Kishan Savaliya May 20 at 7:25

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.