Magento : Difference between Registry and Session

Magento Registry vs Session

Please find the difference between Registry and Session in Magento explained below.

-> The Magento registry never persists after page load, as we go to a new page we will not see those registry variables set yet. Registry is generally used to communicate between blocks and controllers.

-> The session will persist, but internally magento uses its own sessions which can be cleared on magento core calls. Ex. if you place an order, all data will be lost for checkout/session. It’s best practice to create your own custom session to avoid any issues like clearing it at the wrong time.

Leave a Reply