Skip to content

Magento: Set, Get & Delete Cookies

this is example how to manage cookies in Magento:


Set Cookies:

$name_c = ‘cookies_name’;

$val_c = ‘cookies_value’;

$expired = 31556926; /* 1 year */

$path = ‘/’;


$cookie = Mage::getSingleton(‘core/cookie’);
$cookie->set($name_c, $val_c ,$expired,$path);

Get Cookies:

$name_c = ‘cookies_name’;

$cookie_value = Mage::getModel(‘core/cookie’)->get($name_c);

Delete Cookies:

$name_c = ‘cookies_name’;


So easy right? haha 😀


One Comment

  1. Heyаa i’m foг the first time here. I found tҺis
    boаrd and I find It really useful & it hеlρed me out much.
    I hope to gіve something back and aid others like you
    hеlped me.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.