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

Enhancing Productivity with Dynamics 365: The Power of Session Restore

Spread the love Enhancing Productivity with Dynamics 365:

Salesforce Admin

Spread the love In our last blog, we discussed common

Unlocking AI with Spring Boot: Real-World Use Cases and Solutions

Spread the love Artificial Intelligence (AI) has moved from

Enhancing Performance with Reactive Java: A Beginner-Friendly Guide

Spread the love In today’s fast-paced software

Integrating Azure Function with Dynamics 365

Spread the love Signup on azure portal and make sure to

How to Create a Power Apps Component Framework (PCF) with React

Spread the love If youʼve been looking to supercharge your

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

bluethinkinc Blogs