Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What is the difference between <action method=”unsetChild”> and <remove name=""/>?

Both functions are used to remove a block from the layout.

Could someone explain with an example?

share|improve this question
up vote 19 down vote accepted

<remove name="" /> operates in the global block scope of Mage_Core_Model_Layout. These are collected in Mage_Core_Model_Layout::generateXml() and used to prevent the block with the specified name from even being instantiated. Also, any child blocks declared for a <remove />ed block will also not be instantiated.

<action method="" /> a.k.a Mage_Core_Block_Abstract::unsetChild() is a block-level method which de-lists the indicated child block (by alias, not by name) from the parent block instance on which the action is being called. This most often results in the block "disappearing" from the rendered output, even though the block instance is still created. Used in combination with the ::append() or ::insert() methods, it is used to perform a "move".

share|improve this answer

<remove name="" /> ,When finished with all layouts, Magento will completely delete the block with indicated name="", regardless of which layout handle it has been added to. Using this method it is impossible to remove a block from one location and then add it to another

<action method="unsetChild"> operates only in the context where it is being used. unsetChild is created for moving existing blocks from one place to another. You need to use this method if you want to remove a specific block from a specific layout handle and then insert it to another position or layout handle.

share|improve this answer
Not quite; see my answer for corrections. – benmarks Feb 6 '14 at 19:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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