1

What is the similar code in Magneto2 to delete core cookies?

$cookies = Mage::getSingleton('core/cookie')->get();
foreach($cookies as $cookieName) {
     Mage::getSingleton('core/cookie')->delete($cookieName);
}
0

Don't this find this cookie. Might be magento2 remove this concept.

I have checked at the related files.

My suggestion to use php cookie variable $_COOKIE.

Check that Magento\Framework\Stdlib\Cookie\PhpCookieManager.

  • Already found the delete cookie code $this->cookieManager->deleteCookie(self::COOKIE_NAME);, but in this code need to specify cookie name to delete, And my requirement is to delete complete cookies. – Vinaya Maheshwari Jun 15 '18 at 13:06
  • Yes, you get add / delete a cookie – Amit Bera Jun 15 '18 at 13:15
  • But does not get any method which given list Cookie – Amit Bera Jun 15 '18 at 13:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.