How to deal with the Envato iframe when you have a WooCommerce site

Hello everyone,

If you are showcasing anything in WooCommerce you will notice that while your site is inside the Envato iframe you cannot add anything to the cart. That is because WooCommerce session don’t work while in a iframe.

The solution is only to have the user view the site without an iframe. In order to do this you may notice that solutions that used to work before don’t any more, at least that is what happened in our case. None of the previously js or php based solutions seem to work for modern browsers, at least not without altering browser specific behavior, but that isn’t what we are looking for here as we want a solution that will work for any user that is viewing the site.

So, after a long search we decided to share the only acceptable solution that works for us. Surprisingly, it is pretty simple. All you need to do is add the following code to the head tag of the site:
<base target="_parent">

This solution will work as long you you don’t point the demo url directly on a product but eg on the homepage and that is the only requirement for this to work. The user would need to make at least one click and as soon as they do the main (parent) window will have your site’s address and the Envato iframe will disappear.

We hope this helps as not everyone is aware of this iframe issue and how it affects potential buyers.