Today we talk about how to use Prestashop session and cookies. The first thing you must know Prestashop did not use the session it is using the cookie for storing the data So let talk about the cookies. In this tutorial, we focus on set cookies, get cookies, and unset the cookies. So let’s start it.
You can get the cookie variable by following.
in the Controller file.
$cookieObject = $this->context->cookie;
$cookieObject = Context::getContext()->cookie;
To store an array in cookies you need to serialize data. an example is below.
$array = array('a','b','c');
Last Modified: October 12, 2020