Request Quote

Add Custom Catalog Input Type in Magento 2

Add Custom Catalog Input Type in Magento 2

Today we will see how to add custom catalog input type in Magento 2. An event adminhtml_product_attribute_types is dispatched when the catalog input types are displayed. This event can be used to add custom catalog input types.

First in etc/config.xml file inside your module

<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">

Next in etc/adminhtml/events.xml file inside your module

<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="adminhtml_product_attribute_types">
        <observer name="webkul.custom.attribute" instance="Webkul\CustomAttributeType\Observer\AddCustomAttributeType" />

At last in your observer file path mentioned above


namespace Webkul\CustomAttributeType\Observer;

use Magento\Framework\Event\ObserverInterface;

class AddCustomAttributeType implements ObserverInterface
     * Add new attribute type to manage attributes interface
     * @param   \Magento\Framework\Event\Observer $observer
     * @return  $this
    public function execute(\Magento\Framework\Event\Observer $observer)
        // adminhtml_product_attribute_types
        try {
            $response = $observer->getEvent()->getResponse();
            $types = $response->getTypes();
            $types[] = [
                'value' => 'custom',
                'label' => __('Custom')


            return $this;
        } catch(\Exception $e) {
              echo $e->getMessage();

This will add a new catalog input type.

For more details you can see this magento file


That’s it.

Happy coding 🙂


. . .


Add Your Comment

Be the first to comment.

Hire Us!
Brief us about your requirements and we'll get back to you.
Woo! Hooy!
We have just recieved your project brief and our expert will contact you shortly.
Send Again