img_url not returning http(s)

New Member
1 0 0

I'm going crazy here and I know I am missing something. I have the following following code in my product.liquid section:

{{ product.featured_image | img_url: "master" }}

this is returning the following:

//cdn.shopify.com/s/files/1/1862/1887/products/image......

Http(s) is not being prepended. What am I missing? {{ product.featured_image.src | img_url: "master" }} Is not working either.

0 Likes
Highlighted

You aren't missing anything, that's the default behavior implemented by Shopify liquid engine.

Nowadays when browsers need to solve an URL starting with just 2 slashes (//) they automatically derives the protocol from the base page and add HTTPS.

For example just check the Network tab in Chrome Dev Tools and you'll see that Chrome prepend HTTPS to the image URL.

• If the problem is solved remember to click ✅ to Accept Solution
• Press Like, if the answer was helpful
• Shopify/Shopify Plus custom development, optimization and consulting. You can hire me here.
0 Likes