forEach is not a function error

Hi @MOHANTHANGARAJ

When you call to this.aggregateCart('cart'), the cart parameter you’re passing to the function is a string, and as such, it doesn’t implement the forEach() method like arrays and other iterable objects do. That’s why “cart.forEach is not a function”, because forEach is undefined.

I hope it helps,
Rodrigo

1 Like