MAGENTO 2 HOW TO CREATE CUSTOM CATEGORY ATTRIBUTE

 In Magento blog

In this blog, we are going through how to add custom category attributes in Magento 2.

Why Create a Custom Category Attribute in Magento 2? Because in a category you need to add some external text, numbers, multiple choice categories, etc. you can create category attribute

In this blog, we create category attributes using the latest technology  “data/patch”.let’s start with how to create categories attribute.

⇒    First of all, you create “CategoryAttribute.php”  in this directory “Vendor_name/Module_name/Setup/Patch/Data/”.

⇒ After that you need to create “category_form.xml” in this directory “vendor_name/module_name/view/adminhtml/ui_component“.

⇒ and last you need to run this command in the root directory

  • php -dmemory_limit=2G bin/magento setup:upgrade
  • php -dmemory_limit=2G bin/magento setup:static-content:deploy -f -j
  • php -dmemory_limit=2G bin/magento cache:flush

⇒ after checking the custom category created successfully.  If you have any questions regarding this blog let me know in the comment section.

Thank You !!!!

Leave a Comment


0