Change Products Thumbnail preview into square format

Hello!

I was wondering if anyone could help me change the size of the thumbnails in product pages. I would really like them to be in a square format. I know it is possible to do it through coding but I wasn’t able to find it for days.

Thank you so much!

( See example: https://www.madeoftears.com/collections/earrings/products/victory )

@Zine - it can be forced using css but few of the images will not look good.

1 Like

Would you please mind sharing the code please? I’ll have a go at it :slightly_smiling_face:

@Zine - please add following code to the end of theme.scss file and check, adjust numbers as per need

.product-single__thumbnail-image {width: 90px; height: 90px;}
1 Like

Thank you! As you advised, it’s not the best but it worked :grinning_face_with_smiling_eyes:

Alternatively you can crop the images with liquid filters, just scroll down to the Crop section here for more details:

https://www.shopify.com/partners/blog/img-url-filter

1 Like

Yes that’s what I’ve been trying to do for days but it didn’t work at all. I used this but nothing changed :weary_face:

{{ product.featured_image | img_url: ‘450x450’, crop: ‘center’ }}

Well that code would only affect your featured image. You’d have to track down in your code exactly where the thumbnail images are output and apply the filter to the correct liquid output. Probably would look something like:

{% for image in product.images %}
  {% unless forloop.index0 == 0 %}
    
  {% endunless %}
{% endfor %}

I have no idea if that’s what your code looks like, but you’ll be looking for the image loop in product-template.liquid most likely

1 Like

I’m in product-template.liquid and the only code I could find that contain src is:

{{ featured_media.alt }}

If I remember properly, I modified that code but it didn’t change anything (I think because it is related to featured media as you said..) I don’t know If I am allowed to but here is the code I have for the thumbnail in product-template.liquid

{% if product.media.size > 1 %}
{% if product.media.size > 4 %}
{%- assign enable_thumbnail_slides = true -%}
{% endif %}

{% if enable_thumbnail_slides == true %} {% include 'icon-chevron-left' %} {{ 'sections.slideshow.previous_slide' | t }} {% endif %} {% if enable_thumbnail_slides == true %} {% include 'icon-chevron-right' %} {{ 'sections.slideshow.next_slide' | t }} {% endif %}
{% endif %}

Thank you for your help again! :slightly_smiling_face: