On a store im working on, when you follow a link to a specific variant (/products/the-product?variant=12345678901) the image on the product page is the featured image of the product. It needs to be the variant image of the selected variant.
How do I go about doing this? I've tried editing product.liquid to:
{% assign featured_image = product.selected_or_first_available_variant.featured_image %}
{% assign featured_image = variant.image %}
but neither work.
How should I do this?