+92-301-1000201 [email protected]
17 views

Magento 2 allows the admin to create different product types and edit them from the backend Catalog > Products > Product edit form.

With innovations in E-commerce, the default features may not be enough to meet the business requirements. However, Magento 2 flexible to tweak or add new features, buttons, forms, or any components.

Today, I’ll show one such method to add a custom button in the admin product UI-component form in Magento 2.

Using the below code, the admin can use custom buttons in the product edit form in the backend. For example, generate a barcode for the product, or check the preview of the product frontend.

For example,

add a custom button in the admin product UI-component form

Method to add custom button in the admin product UI-component form in Magento 2:

Create a product_form.xml file at  app/code/Vendor/Extension/view/adminhtml/ui_component directory

Next you have to create a CustomButton.php file in app/code/Vendor/Extension/Block/Adminhtml/Product/Edit/Button directory

add-custom-button-in-the-admin-product-ui-component-form-in-magento-2That’s it.

Any doubts in the above solution can be mentioned in the Comments section below.

Also, do share the solution with the Magento Community via social media.

Thank you.