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

Customize lead qualification for a seamless experience

Spread the love When the 2024 Release Wave 2 was launched,

Create a Custom Console Command in Spryker

Spread the love In Spryker, developers can create custom

SALESFORCE

Spread the love Salesforce is a cloud-based software

CRUD Operation in Spryker Backoffice with a Custom Module

Spread the love Spryker is a highly flexible and modular

How to create custom module on Spryker for Backoffice?

Spread the love Creating a custom module in Spryker

How to Install Spryker Project with Docker on Local Machine

Spread the love Spryker is a flexible and scalable commerce

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

bluethinkinc Blogs