Jump to content

Issue with variant product images not displaying when selected

Recommended Posts

Posted (edited)

Hello support,

 

Product variant images seem to only work on the 'Shop' page.

 

Whenever I insert a product block on any other page, the following happens:

 

The featured image always displays, but...

...whenever you select a different image, the inventory image simply disappears completely.

 

It does this for every product that we are selling.

 

We have triple checked that all the variant options are correct and linked to images.

And, as said, they work perfectly fine on the shop page.

 

Have pictures attached showing step by step what happens.

 

Thank you,

Dominic

 

 

 

 

 

 

Screen Shot 2023-05-21 at 6.35.44 am.png

Screen Shot 2023-05-21 at 6.35.51 am.png

Screen Shot 2023-05-21 at 6.35.57 am.png

Screen Shot 2023-05-21 at 6.36.10 am.png

Edited by DomBrady
  • Replies 5
  • Views 2.5k
  • Created
  • Last Reply

Top Posters In This Topic

Posted (edited)
On 5/20/2023 at 9:41 PM, DomBrady said:

Product variant images seem to only work on the 'Shop' page. Whenever I insert a product block on any other page, [the second and subsequent images disappear]

@DomBrady This is a bug. According to Squarespace Customer Care, Engineering teams are currently prioritizing a fix for this [21 May 2023].

image.gif.3ef37fa536bb540fdf0bbe8eaa9ce337.gif

 

Did this help? Please give feedback by clicking an icon below  ⬇️

Edited by paul2009

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

  • 2 weeks later...
Posted

Thanks. It is been there a long time.

If you hear anything, I would love to hear it.

Surprised noone else seems to have mentioned it.

  • 1 month later...
  • 7 months later...
Posted (edited)

I've raised the issue as well, and just now, after almost a year, there's still no fix. Is there any code I can add to fix this, in my mind, major issue with Squarespace?

Selecting the colour and the pair or single option should show the desired image, as it does in the main store, but it just removes the standard image and shows none. This is essential for my customers to be able to choose a product. Does anyone have any suggestions; code or workarounds?

https://www.pockethearing.com/signia-silk-x

image.thumb.png.d387f4b274723bac6555a7459e6dfd82.png

Edited by Hungryfijian
  • 3 weeks later...
Posted

I ran into this issue and in my case it looks like the other variant images lack the src attribute for some reason. I was able to hack a workaround for this. If you add this to your header code you should be able to see the other images:

<script>
  document.addEventListener("DOMContentLoaded", function() {
    // Find all variant images
    var imgTags = document.querySelectorAll('img.sqs-product-block-variant-image');

    imgTags.forEach(function(img) {
        // Check if the img tag has a src attribute
        if (!img.hasAttribute('src')) {
            // If it doesn't have a src attribute, add one from the data-src attribute
            var dataSrc = img.getAttribute('data-src');
            if (dataSrc) {
                img.setAttribute('src', dataSrc);
            }
        }
    });
});
  
</script>

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.