Ecommerce Web Development and Support - WebCoderbd

Ecommerce Web Development and Support - WebCoderbd

Share

Having a robust eCommerce website is the foundation of your online business, and we understand the importance of utilizing the latest technology to increase your profitability. Our eCommerce solutions offer the best in standard features and functionality while remaining completely customizable. Our team will discuss your custom functionality needs and tailor a solution that matches your online brand and eCommerce goals.

16/06/2019

How to set cookie on a phtml file in Magento 2

Magento 2 cookie will not work when cache is enabled. You have to make your phtml file uncacheable.

Use cacheable="false" property in your xml.


Now You can use cookie manager in your phtml file.

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$cookieManager = $objectManager->get('Magento\Framework\Stdlib\CookieManagerInterface');

// Set cookie
$cookieManager->setPublicCookie('cookiename', 'cookievalue');

// Get cookie
$cookieManager->getCookie('cookiename');

// Delete cookie
$cookieManager->deleteCookie('cookiename');

RASODGHOR | রসদঘর 01/03/2019

Online Grocery Store
Site Url: https://rasodghor.com/
Builtwith : Magento 2.2.3
Developed by: WebCoderbd Ltd

RASODGHOR | রসদঘর

Want your business to be the top-listed Computer & Electronics Service in Dhaka?
Click here to claim your Sponsored Listing.

Telephone

Address


103 Boshiruddin Road
Dhaka
1205

Opening Hours

Monday 09:00 - 23:00
Tuesday 09:00 - 23:00
Wednesday 09:00 - 23:00
Thursday 09:00 - 23:00
Friday 09:00 - 23:00
Saturday 09:00 - 23:00
Sunday 09:00 - 23:00