How to delete cookie in Magento 2?

Magento 2, You can delete the cookie using Magento’s Own Magento\Framework\Stdlib\CookieManagerInterface interface class.

You can delete cookie using deleteCookie() function from CookieManagerInterface Interface.

If you have set the cookie using cookie’s $metadata property, You need to inject Magento\Framework\Stdlib\Cookie\CookieMetadataFactory factory in your class to delete the cookie.

Model class for delete cookie,

In the above function, the cookie name is magento2cookie. first check if a cookie is set, if Yes, delete a cookie with help of cookieMetadataFactory.