Help with the Agile Depot application tutorial

anyone can explain me why in the Agile Depot Tutorial application they
use i.product_id
to find if a product already exist in the cart, because the cart
contains items, each of them references a product.

I tried i.product_id like in the tutorial

all of these 2 notation works , but i find the second seems more
clean??? isn’t it.

Any explanation will be fine