jQuery, Magento2

How to use Cookie in Magento2?

use cookie in magento2

In this blog We will discuss the topic of how to use Cookie in Magento2? Cookies are the most used technology for storing data on the client side.

You can add below code in your phtml file or convert that code for js file also.

Set cookie : To both create and retrieve a cookie, jquery.cookie uses the same method, cookie(), but with a different number of parameters.

To create a cookie you need to pass in two required parameters, the name and value of the cookie, respectively. You can pass a third, optional, parameter that is an object literal containing some additional options.

These options are pathdomainexpires, and secure.

How to Get cookie?

How to add condition if cookie set or not?

View, Edit, And Delete Cookies With Chrome.

DevDocs Home

🙂 Happy Coding. Keep Liking & Sharing 💻

Tagged , ,