All things Shopify and commerce
Hey guys,
I can't display my product images using this liquid snippet from the shopify liquid cheatsheet.
{% for image in product.images %}
<img src="{{ image.src | product_img_url: 'medium' }}">
{% endfor %}
Is there any other way I could display all images of a product on demand with another liquid snippet?
Solved! Go to the solution
This is an accepted solution.
I found this one to work best for me.
{% for image in product.images %}
{{ image | image_url: width: 30, height:30 | image_tag}}
{% endfor %}
What do you guys think about it?
You can try to use this code instead.
{%- for media in product.media -%}
{{
media.preview_image
| image_url: width: 1946
| image_tag:
loading: lazy,
sizes: 500,
widths: '246, 493, 600, 713, 823, 990, 1100, 1206, 1346, 1426, 1646, 1946'
}}
{%- endfor -%}
- Found this helpful? Hit "Like" and "Accept as Solution"! Support me: Donate!
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
Built for Shopify
Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...Sign up now.
Instead of
<img src="{{ image.src | product_img_url: 'medium' }}">
You should do
<img src="{{ image | product_img_url: 'medium' }}">
image.src is a string, but product_img_url expects image object as input.
This is an accepted solution.
I found this one to work best for me.
{% for image in product.images %}
{{ image | image_url: width: 30, height:30 | image_tag}}
{% endfor %}
What do you guys think about it?
It's fine both ways.
product_img_url is and old way of creating image URLs, image_url is a newer one.
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025