Variant images

zomex
Tourist
33 1 10

Hello everyone,


Site: https://decorative-gold.myshopify.com/

Password: bayldo


I have used some code to display variant images in replacement of the default text. This works for some products but others it shows the wrong variant image.


For example: https://decorative-gold.myshopify.com/products/enchanted-gold-rose-dome


^ this works perfectly. The image shown in the variant selection is correct and matches that selected in Shopify.


https://decorative-gold.myshopify.com/products/golden-artificial-plants


^ here the wrong image is being displayed in the variant selection compared to what is set in Shopify. Strangely the same image is used for 4 variants then changes. Note that as per the product each variant has a unique image which you can see when selecting.


My guess is the code I am using is having issues when there is 2 variant options set but works with 1. See attached for the code I am using.

 

Screenshot 2024-02-12 at 09.44.03.png


Any assistance with this would be greatly appreciated.


Thanks.

Web Developer - zomex.co.uk
Replies 0 (0)