How to use addToCart() function from a customized dynamic page(dataset)?

Dear Dara,

Can you tell me if my logic is right?
So I start with addToCart() coding first and when putting in the product ID, set a parameter or array to get the product ID from the repeater?
I am still learning how to set the array for this.

Thank you for your help!