Display last product gallery image into a product feed

LloydSpencer
Shopify Partner
19 0 0

Good morning,

 

I am trying to edit my product feeds code to display the last image in a products gallery rather than the first and was wondering whether this is possible?

 

I came across the following post, however, when I tried to apply the .last filter to the end of the image source it didn't appear to work for me.

 

https://stackoverflow.com/questions/27322846/query-last-image-in-shopify-liquid

 

Below is the product image snippet that I need to edit to pull in the last product gallery image.

 

<img class="lazyload {{ image_class }}" data-src="{{ img_url }}" data-widths="[{{ image_widths }}]" data-aspectratio="{{ image.aspect_ratio }}" data-sizes="auto" alt="{{ alt | default: image.alt | escape }}" {{ image_attributes }} data-image>

 

I'd appreciate and help and guidance on this 😊

Replies 0 (0)