I am trying to add some code to display the variants of a product in the collection pages. I have managed to find some simple code that when added to "product-card-grid.liquid" underneath the price code, it displays little swatch options of the product like this:
It pulls the colors from the variants when they are named something simple which the majority of mine aren't.
But I was really hoping to have it changed to pull the associated image from a variant and use that instead of the color.
Does anyone know how I could edit the existing code to do this instead?
The code for displaying variant color swatches is: