Can I Sum Children Rows if The Values in the Children Cells are a Function of Something Else

I made a unit price column in my sheet that auto-populates prices for specific products. I would like to create a cell that adds those unit price values for a total price value. I have not been able to do so with them being a function of data and not specific data I typed in one by one. How can I do this?