fbpx
Want To Add Extra Images Per Product Variation For Free? Download Now

Thumbnail images are being cropped which we dont want

Graham Saunders

Is there a way to ensure that the thumbnail images show in their entirety and not be cropped. It looks messy when the images are cropped in this manner. All of our product images are in the ratio 1.5 to 1 so the images are rectangular (not square). I have tried adding some custom php code, to not avail. Thanks for your help.
Graham

Hakik Zaman

Hi Graham,

Thanks for reaching out to us.

1. Please add a custom thumbnail size. Here is a reference from the official WordPress Developer Handbook- https://developer.wordpress.org/reference/functions/add_image_size/#comment-296

2. Then use a plugin called Regenerate Thumbnail- https://wordpress.org/plugins/regenerate-thumbnails/

3. Regenerate all the thumbnails using the plugin.

4. Then the newly added thumbnail size will be appeared here- https://paste.pics/QMNH9

5. Select the newly added thumbnail size from the dropdown box.

I hope this will resolve your issue

Thank You

Hakik Zaman

Hi Graham,

Please ignore my previous reply. Sorry for the inconvenience.

Please check this official article to resize thumbnail size- https://developer.woo.com/docs/image-sizing-for-theme-developers/#2-changing-image-sizes-via-hooks

I think this example will fit-

add_filter( 'woocommerce_get_image_size_gallery_thumbnail', function( $size ) {
return array(
'width' => 150, //Your desired size
'height' => 150, //Your desired size
'crop' => 0, //Will make it uncropped
);
} );

Thank You