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

Apr 8, 2016269Aleksei 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

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.


Tags:

4 Comments

  1. 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.

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

  3. 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!

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

Post a new comment

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