I'm creating some custom fields for my categories, so I've added a couple of simple text fields in the database with the setup php script, then extended the category_form.xml to show my fields in the admin category page. Everything works fine: I see the fields in the admin category page and I can save the values.

I'd like to add a line of comments under those fields. I thought I could just use the comment tag like I do in every other xml form but here I get the error "Element 'comment' is not expected".

Is there a way to add a comment-like sentence under the field?

1 Answer 1


there is a note field in the eav_attribute table. This field is used to store the label that appears below the fields in the admin screen.

As a consequence, you can add a data patch that updates the category attribute you have created so that the note's value for this attribute has the label you want to set.

Below is an example for product at \Magento\Catalog\Setup\Patch\Data\UpdateProductMetaDescription. I did try manually for category and it works indeed.

/** @var EavSetup $eavSetup */
        $eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);

                'note' => 'Maximum 255 chars. Meta Description should optimally be between 150-160 characters'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.