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

Proxy Design Pattern and Requisition List in Magento 2

Spread the love Requisition List in Magento 2 Requisition

Google Ads Conversion Tracking Through Magento Platform:

Spread the love Google Ads Conversion Tracking Through

Object Pool Pattern in Magento2

Spread the love What is Object Pool Pattern in Magento 2 An

JENKINS

Spread the love JENKINS Introduction and Installation

Virtual Type and Type

Spread the love Virtual type is one of the most common

Customize the length of Input field

Spread the love Sometimes we need to change the limit the

How to Add Custom Tab on Admin Dashboard and Count Website Total Visitor in Magento 2?

Spread the love In this blog we’ll see How to Add Custom

How to Add Sign Out Tab in Customer Account in Magento 2?

Spread the love In this blog we’ll see How to Add

How to create custom tab in product detail page in magento 2?

Spread the love In this blog we’ll see how to add

Understanding and Implementing CORS & CSRF

Spread the love What is security? The world has become more

bluethinkinc Blogs