Web Analytics

Fill the form & Get Installation Support

How to set cookie variable in Magento 2?

In today’s article we are going to describe that how to create cookie variable and assign value into it. We made a module for it and named it “Magemonkeys_General”

The first step is to create a block file for this in Cookie.php location which is  app/code/Magemonkeys/General/Block/

Then create cookie.phtml file in below location app/code/Magemonkeys/General/view/

Set cookie :

Get cookie :

That’s it.

Fill the below form if you have any Magento programming need.

    Recent Articles

    Author Info

    Author Image

    Magento 2 Developer

    Hire P. Garchar

    Get a Free Quote

      /* second popup */

      Connect With Us