How to Add Custom dropdown type Attribute in Category Form in Magento 2

Blog
Spread the love

In this blog post, we will learn how to create a custom dropdown attribute using data Patch in Magento 2. By following the steps outlined below, we can easily add any type of attribute, such as text or dropdown, in the category form.

Step 1: Module Creation

First, create a module by following these steps:

Create a file named module.xml under the directory app/code/Bluethinkinc/CustomCategory/etc with the following content.

Step 2: Register the Module

Create a registration.php file to register your module with the following content.

Step:3 Create a Data Patch

Create a Data Patch to create your custom attribute with the below content under following file path

Bluethinkinc\CustomCategory\Setup\Patch\Data\ AddCustomCategoryAttribute.php

Step 4: Create Custom Options

Create a file named CustomOptions.php under the directory Bluethinkinc\CustomCategory\Model\Config\Source with the following content, This file is responsible for the options which you want to show in your category form dropdown attribute.

Step:5 Finally, Create category_form.xml under

Bluethinkinc\CustomCategory\view\adminhtml\ui_component directory.

Now you need to run the necessary commands and you can successfully add a custom dropdown attribute in the category form in Magento 2.

extention_2023

Amit Soam

Amit Soam

2023-10-31

0

Leave a Reply

Your email address will not be published. Required fields are marked *

Find More Blogs

How to Add a Custom Tab to the Customer Order Detail Page in Magento 2

Spread the love Adding a custom tab to the Order Detail

Exception Handling in Java

Spread the love Introduction – Exception:An unwanted

How to add custom less file in Magento2

Spread the love Source files *.css included into layout

Spring Boot Microservices

Spread the love Microservices architecture has become

Implementation of WireMock for better testing

Spread the love WireMock is a flexible and powerful tool

Magento 2: How to selected default option in configurable options?

Spread the love Configurable products in Magento 2 allow

How To Implement Simple JWT Authentication in Django Rest Framework

Spread the love We’ll learn how to use simple JWT

Optimizing Search: Integrating Elasticsearch in Django Applications

Spread the love What is Elasticsearch? Elasticsearch is a

How to create Customer Segments

Spread the love In Magento 2, “customer

Proxy Design Pattern and Requisition List in Magento 2

Spread the love Requisition List in Magento 2 Requisition

bluethinkinc Blogs