Get Free Audit

How to Hide a Field on a Product Edit Page in Magento Backend Using Observer

Apr 8, 2016

2297 Aleksei Grigorenko

How to Hide a Field on a Product Edit Page in Magento Backend Using Observer

There is a specific set of fields that are displayed by default on the product settings page. However, there can be certain conditions when the fields should not be displayed, for instance: Minimum Sell Price attribute should be editable for the Admin access level users, but others should have no access to this field.

How to Hide a Field on a Product Edit Page in Magento backend Using Observer

Add a new event to config.xml  core_block_abstract_prepare_layout_befor

Igor Dragun
Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Igor


Then add the following code to Observer.php


As a result the field Minimum Sell Price will not be displayed on the product settings page.

Igor Dragun
Partner With Us Looking for a partner to grow your business? We are the right company to bring your webstore to success. Talk to Igor
Tags:

4 Comments

  1. Hi Johann,
    You can add a new condition $block->getProduct()->getTypeId() == ‘configurable’ and then hide an attribute.

  2. Hi! I need help hiding an attribute from configurable product in admin, but I want it to be visible in simple products.
    Also, I don’t know to which files you are referring to in the tutorial. Sorry! I’m a Magento newbie.
    Thank you!

  3. Prajakta,
    Thank you for this question!
    We will do our best to answer it in our future articles.

  4. How to achieve same in magento 2 ? I have tried, but not getting the exact event in which we can capture the attributes and unset them.

Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *