I want to add a warning message on the product page but it's not working if full page cache is enabled. I'm using the following event
<event name="controller_action_predispatch_catalog_product_view"> <observer name="product_view_custom_action" instance="My\Module\Observer\Custom"/> </event>
And in observer execute I have the following
$this->messageManager->addWarningMessage(__('My warning message'));
Is there a method that I could do this to show the warning message every time. Even after the page is cached?