offset:last

Tourist
10 0 0

Hi ,
i have a question , i want to disabled the last image in product.images, i tried to use <= offset:last => but not work,
any answer about.

 

regeard,

Sadek

0 Likes
Highlighted
Shopify Expert
9542 28 1310

If you're doing a loop over images you'd have two options.

The first would be to use limit vs offset. and have that value being the total number of images minus 1.


The other would be to add an if or unless statement within the loop. For example:

 

{% if image.last %}{% break %}{% endif %}

or 

{% unless image.last %}
... code that shows the images
{% endunless %}

^ You may need to adapt that to your needs but hopefully gives you an idea.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
1 Like
Tourist
10 0 0

Thx Jason for fast replay, but did not work in my situation, but tour solve give me a big hint , now it 's work with =>

{% unless forloop.last %}
{% endunless %}

thx,

reagard,

Sadek

 

0 Likes