I want to save temporary data (id and name) from product page to cart via Ajax. The problem is to record new variables in cookie, using outstanding from Joomla file. I tried:
$inputCookie = JFactory::getApplication()->input->cookie;
$value = $inputCookie->get($name = 'myCookie', $defaultValue = null);
$cookieExists = ($value !== null);
$inputCookie->set($name = 'myCookie', $value = '123', $expire = 0);
but in var_dump($_COOKIE) there is no 'myCoolie' variable with value.
And maybe for safety I need to use Session instead Cookie to keep products in cart?