Home » Magento, Magento 219 February 2016

Magento 2: Set Unset Get Session

This article shows how to create and destroy different types (Checkout, Customer, Catalog) of sessions in Magento 2.

As you can see below, there are different types of session classes present in Magento 2.

In below example code, I will be dealing with Catalog, Customer, and Checkout sessions.

Now, we set and get session from template (.phtml) file.

Unset session

From customer session, we can also fetch customer information like customer name and email.

From checkout session, we can fetch quote information.

Hope this helps. Thanks

php magento mukesh chapagain

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed