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

Custom API to Fetch Customer Data by Customer ID in Spryker

Spread the love Introduction In this blog post, we will

Creating a Custom Module for a Custom Frontend Page in Spryker

Spread the love To create a custom module for a custom

How to create custom module api get category list without access token in Spryker

Spread the love To create a custom API for fetching a

Creating a Custom Glue API in Spryker

Spread the love Spryker’s Glue API is a powerful tool

Get AI Generated 360-Degree View of Account Summary in Dynamics 365 Sales

Spread the love Navigating the demanding landscape of sales

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

bluethinkinc Blogs