Website Building » Shopify » How Do You Lazy Load Images on Shopify?

How Do You Lazy Load Images on Shopify?

Last updated on October 1, 2022 @ 10:20 pm

Lazy loading is a technique that delays the loading of images on a page until they are needed. This can improve the speed of your page by reducing the amount of data that needs to be downloaded, and also improve the user experience by not displaying images that are not visible on the screen.

Shopify does not currently have lazy loading built in, but there are a few ways that you can add it yourself. One way is to use a Shopify app like Lazy Load by Appmaker, which will automatically lazy load all of your images for you.

Another way is to use a script like LazySizes, which you can add to your theme.

To lazy load images with LazySizes, you first need to add the script to your theme. You can do this by going to “Edit code” under “Themes” in your Shopify admin, and then adding the following code to your theme.liquid file:

PRO TIP: If you are considering lazy loading images on your Shopify store, be aware that this can potentially impact your search engine optimization (SEO). Lazy loading images means that they are not loaded until the user scrolls down to them, which can mean that search engines are not able to index them. This can impact your store’s visibility in search results.


{% if template.name == ‘product’ or template.name == ‘collection’ %}
{{ ‘lazysizes.min.js’ | asset_url | script_tag }}
{% endif %}

Once you have added the code, all of your product and collection images will be lazily loaded. If you want to lazy load other images on your site, you can add the following code snippet to wherever those images are located:


{{ image.alt }}

Conclusion: Lazy loading is a great way to improve the speed and performance of your Shopify store, and there are a few different ways that you can add it yourself. using a Shopify app like Lazy Load by Appmaker, or by using a script like LazySizes.

Kathy McFarland

Kathy McFarland

Devops woman in trade, tech explorer and problem navigator.