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?

2 Answers 2


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

  • Just to add to this, if the block does not have an alias then it will match the name.
    – Ben Crook
    Jun 23, 2017 at 9:20
  • 2
    Correct, when no alias is provided, the alias for a child is set to its name. 👍
    – benmarks
    Jun 23, 2017 at 12:26

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

  • Not quite; see my answer for corrections.
    – benmarks
    Feb 6, 2014 at 19:45

Your Answer

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

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