I am having problem add to cart in Ionic framework iframe, the button just stuck at Adding...
without adding the item to cart.
I noticed there are some errors/warnings in the Network tab. It says the SameSite cookie was set to LAX because it was not found. Refer to the image below.
So my question is how do I set the SameSite=None as the default cookie in Magento 2? Thanks in advance.
2
Answers
Firstly, try to refactor the domains you use. If everything comes from the same domain, it is not "cross-site response" and this flag is not needed. To know more about why cross-site things are forbidden, have a look at https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
Secondly, try to upgrade to the latest version (as said by @Tarun), which seems to solve the problem.
Since the current
SameSite
default for Chrome isNone
, third-party cookies can track users across sites. The update changes the default label toSameSite=Lax
. It means that cookies are set only when the domain in the URL of the browser matches the domain of the cookie. In this situation, we deal with first-party cookies.As for cookies with the
SameSite=None
label, they must have a secure flag. It’s a guarantee that they are created and sent only through requests made overHTTPS
.Unfortunately, some languages and libraries do not support the None value yet. As a result, developers should set the cookie header directly. Check this Github repository, to discover how to implement
SameSite=None
.