Updating the Total

Learn how to correctly calculate the quantity attribute.

We'll cover the following

Did you notice that the total is being miscalculated? Currently, it is just adding the price for the products on order regardless of the quantity requested. Let’s add some code to fix the problem. At the moment, we have the following method to calculate the amount to pay in the Order model:

Get hands-on with 1200+ tech skills courses.