Question

I am creating a website with 2 store views - English and Arabic. I would like to add the language switcher inside a popup when a user opens the homepage.

But the popup need to display only once (probably by setting some cookie value or whichever is efficient).

For example, If I add the modal popup in a widget and call it in homepage, is there a way to limit the number of occurrences? Or Could anybody please help me with a better idea on how to do this. Thank you so much in advance.

Was it helpful?

Solution

You could set a cookie when showing the modal, then each time you show it, check if the cookie is already present and don't show it in that case. Just make sure to not set the cookie and then check if it is set, otherwise you would never see the modal.

The flow could be something like this:

  1. Check if the cookie is present
  2. Show the modal if not
  3. Set the cookie if it was not present

You should be able to do most of this in a custom phtml template and the cookie handling in a custom block.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top