Jump to content

Issue with variant product images not displaying when selected

Recommended Posts

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
Link to comment
  • Replies 5
  • Views 1.3k
  • Created
  • Last Reply

Top Posters In This Topic

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

About me: I've been a SQSP User for 18 yrs. I was invited to join the Circle when it launched in 2016. I have been a Circle Leader since 2017. I don't work for Squarespace. I value honesty, transparency, diversity and good design ♥.
Work: I founded and run SF.DIGITAL, building Squarespace Extensions to supercharge your commerce website. 
Content: Views and opinions are my own. Links in my posts may refer to SF.DIGITAL products or may be affiliate links.
Forum advice is free. You can thank me by clicking one of the feedback emojis below. Coffee is optional.

Link to comment
  • 2 weeks later...
  • 1 month later...
  • 7 months later...

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
Link to comment
  • 3 weeks later...

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>

 

Link to comment

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.