I am trying to show or hide a block based on a cookie. The cookie is set on a form submission and whether the user sees the block depends on if they have the cookie set. I have it working but when Full Page Cache is enabled it ignores the cookie and just shows whatever is in the cache.
At it's most basic I have the following at the top of the block phtml:
if(!$allowedToView){
return;
}
// else show the block content.
I don't want to use cacheable=false for obviously reasons.
I have considered using private content to "Hole punch" but I don't need to display personal content, just the block itself. Any suggestions on how best to achieve this?
Thanks.