Archived topic
Woocommerce product gallery thumbs cropped to 100px
5 replies · Started by Sam on March 2, 2022
Hello, I have an issue with thumbs showing as 100px in the product gallery on the single product page. I tested with both storefront theme and 2022 theme and they both used thumbnail images of 150px which matches the thumbnail settings in I have WordPress. So, it seems somewhere GP is setting them to 100px.
If I use the following snippet it shows the images at 300px.
add_filter( 'woocommerce_get_image_size_gallery_thumbnail', function( $size ) {
return array(
'width' => 300,
'height' => 300,
'crop' => 0,
);
} );
The really strange thing with this snippet is that it does not matter what image I set for width/height, it straight away displays images as 300px. If I regen thumbs, it will regen the new size if I set a custom size with the above.
If I use the following snippet, I can use the "medium" image size set in the WordPress media settings, which is what I am doing for now. Alternatively, if I set the below to "thumbnail" then it uses the Worpress thumbnail size in WP media settings.
add_filter( 'woocommerce_gallery_thumbnail_size', function( $size ) {
return 'medium';
} );
Do you know why GP does not respect the WP media thumbnail settings by default? I have read threads with other users with these issues (see here) and GP support has indicated that GP does not set this, which is confusing as it must if it goes back to the media settings when testing base WP themes.
Maybe I am missing a setting somewhere? Note I have checked the customizer and the WP media settings already.
Hopefully, you have an idea, as it is not ideal to use a snippet to work around the issue.
thanks
Hi there,
apart from CSS - GP doesn't interfere with the Woo image attachment sizes.
We don't add the support filter that Woo provides:
https://woocommerce.com/document/image-sizes-theme-developers/#section-1
Which means it uses the default sizes that Woo sets:
Which you can see are set to 100.
If other themes are returning a different result then i assume they are changing it in their setup.
Right ok makes sense, thanks for confirming.
Do you intend to introduce a way to control it in theme settings or will I need to continue to use a custom snippet?
For now you will need to keep using the snippet.
Its on our radar as a potential feature option but there are some concerns for example:
Woo has yet to address the absence of width and height attributes of those images which may require a function rewrite. So we would sooner wait and see what happens there.
And of course theres the ever questionable implementation of Woocommerce block templates.....
Right I see, seems Woocommerce has quite a lot to fix up!
It sure does lol
:)