Foreach
Foreach action is just a more readable way of handling iteration over an array. Only thing to keep in mind is that Iterate over is JavaScript expression, if you want to reference data from other actions you need to use ctx object. Iterator variable on the other hand is not an expression but is just a name for output value that will be stored in ctx object.

Iterator variable
Iterator variable is not an expression but a name for where to store the currently iterating item. With above example first item will be ctx.product = ctx.products[0]
and so on for each iteration.
Last updated