Product images

Is there a way to have just one product image show and then when they change the variants then the image will show for that variant?

3 comments

  • michaelsteelemichaelsteele Posts: 41Member
    yeah, but how you do it depends on your theme's code. If you have already used the theme editor and forfeited theme updates and support, feel free to share the product.rain code using gists or codepen.
  • Adrian SamuelAdrian Samuel Posts: 368Moderator, Lightspeed Staff moderator
    @sacredheart926 if you're talking about the home/index.rain page then you want to display a selection of products (most themes have this by default) and possibly have a drop down to select the specific variant. Based on the variant selection you could have an AJAX request made to toggle the specific image depending on the item clicked.

    More information can be found here: 
    https://ecom-support.lightspeedhq.com/hc/en-us/articles/115002509593-3-f-AJAX-and-JSON

    You might want to use indexedDB or session Storage to cache the images that you load so you don't have to make too many AJAX requests which would result in getting your shop banned.

    Instead of AJAX, you could have a cloud function respond with the a payload with the variant image etc...there are a lot of ways it could be done
  • JoeyJoey Posts: 141Administrator, Moderator, Lightspeed Staff moderator
    edited November 2018
    Switching images based on selected variant is a build in feature and does not depend on the theme. The first thing to do is to click the [+] icon next to the variant and assign one of the product images.
    Once variant images are assigned it would be up to the theme code to display them the way you want, as @michaelsteele mentioned.
    eCom Support Team
    Lightspeed HQ
Sign In or Register to comment.