Posted by

How to pass the iterated data inside the for loop of Hubspot's HUBL.

Hubspot has become one of the popular platform to consider for building your website. And if you've been using it for awhile in developing themes or module, you might have experienced that the variable inside the loop is undefined outside from it.

And if have an app that requires you to get the value from the loop, here's how you can do it.

First is to set an array variable. Yes, an array.

{% set varname = [] %}

Second is to place this code inside the loop.

{% do varname.append(item) %}

Now after the loop, all the value(s) you appended on it from the loop are available for you to use.

Happy coding!