Making "Add to cart" Button choose specific variant

Hi there,

So I wanted to make my shop look better by having a repeater on the page and customising all the information on the page, then I coded out tons of different “add to cart” buttons that show when certain images show up on screen (my work around to have add to cart button affected by repeater) but I am unable to choose the specific variant that the button puts in the cart, and I don’t want people to after click what they want when they just did in my repeater. Is there a code to determine specific variations of your item when people click the button?