I'm currently in the process of creating a cart system using vuejs and I've encountered an issue where my total variable is displaying NaN instead of calculating the total price of all products.
Below is the function responsible for calculating the total
total: function(){
var totalPrice = 0;
for (var item in this.products){
totalPrice += item.price;
}
return totalPrice;
}
Next, here's how I have it set up in my template for display
Total Price: ${{total}}