So recently we were adding more items to our store and noticed our image selector was no longer changing the variant selector when clicking NEW items that were recently added vs old items still changed it. I had originally added the code that was on the forums to make it work (I dont remember where I found it but it was similar to this).
The issue I found is if you go to the part that says:
const thumbnails = document.querySelectorAll(‘#’+ sectionId + ’ img[src*=“/files/”]');
The old post use to be “img[src*=/products/”]'); " rather than from files. So when we look at new images the url address contains /file/ path rather than the old product images containing /product/ path.
So now if we use old code the selectors only work and change for old images, and if we use new code it only changes for new item images and not old..
How do we fix this?