Theme files
Shopify integration - theme files
You need to adapt your individual theme files for the image URLs to be changed to Cloudimage URLs. Identify first which theme files are used by your shop and edit them one by one as detailled below.
Here are a couple of examples indicating the change that needs to be made in the theme files. You can follow similar steps to change all of your theme files. List of some files that need to be changed (files may vary between themes):
featured-product.liquid
product-template.liquid
collection-grid-item.liquid
Product-grid-item.liquid
header.liquid
video.liquid
As general what you need to do is:
assign new variable inheriting the original theme image url
replace the old image invocation with inclusion of cloudimage
Example 1
You can make the changes inside product-template.liquid.
Before:
<img id="{{ img_id }}"
class="product-single__photo lazyload{% unless featured_image == image %} lazypreload{% endunless %}{% if section.settings.product_image_zoom_type == 'lightbox' %} lightbox{% endif %}"
{% if section.settings.product_image_zoom_type == 'zoom-in' %} data-zoom="{{ image | img_url: '1024x1024' }}"{% endif %}
src="{{ image | img_url: '200x200' }}"
data-src="{{ img_url }}"
data-widths="[180, 360, 470, 600, 750, 940, 1080, 1296, 1512, 1728, 2048]"
data-aspectratio="{{ image.aspect_ratio }}"
data-sizes="auto"
alt="{{ image.alt | escape }}">After:
Example 2
Before:
After:
Example 3
Before:
After:
Example 4
Before:
After:
Example 5 - with capture
If there is a tag inside image URL and you cannot simply assign it, use capture
Before:
After:
Example 6 - Video
Before:
After:
You can also take a look at the FAQ section.
Was this helpful?

