Menu Close
    Start a Project Request quote Reading list Switch to dark mode

    Add fields in admin Category Form magento2

    Today we are discussing how to add custom attributes/fields in category add/edit page in admin panel in  magento2.

    Firstly you have to create attribute for category.

    For example: you have created an attribute with attribute_code: “category_test_field”.

    Now, in magento 2.1.0 it does not displays the attributes by default in the form, to display attribute in category form you have to define it in ui_component.

    Now, create a file under app/code/Webkul/Test/view/adminhtml/ui_component/category_form.xml


    category_from.xml : file name should be same, because we add a field in existing form. category_form is already defined in magento/catalog to display form.

    <fieldset name=’general’> : is the name of group in which you want to display your field.

    <field name=’category_test_field’> : is the attribute code to set/get the values of attribute.

    sortorder : is the number in which position you want your field in the form.

    datatype : is the type of data in which it stores the data.

    formelement : which type of form element you want to display for your attribute. for example: input, select, checkbox, etc.

    label : label of the attribute.

    default : default value to display.

    After this your field is displayed on the category form.

    Thank you.

    . . .

    Comment (1)

    Add Your Comment

  • Ragubathi U
    Thanks for the post.I have problem with saving the custom field added by above code.Do I wanna create attribute in Stores->Product Attributes?
  • Back to Top
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again