Support » Plugin: WooCommerce » How to prevent Woocommerce Gallery Thumbnail from being stretched?

  • Resolved lychee128



    How do I prevent my Woocommerce_gallery_thumbnail image to not be stretched out?

    I have added the below to my child functions.php file:

    add_filter( ‘woocommerce_get_image_size_gallery_thumbnail’, function( $size ) {
    return array(
    ‘width’ => 100,
    ‘height’ => 100,
    ‘crop’ => 0,
    } );

    I have regenerated thumbnails and know that my image is 100×48 so fits within the above dimension.

    However, regardless of what theme I use, the image appears stretched out.

    Please see screenshot link for what I am talking about.

    It looks like my thumbnail is being stretched to fill in the 100×100 space even though the image is only 100×48.

    I am using a variation swatch plugin but this seems to happen with a number of plugins that I’ve tested. I am also using the Storefront theme so I don’t think the theme makes a difference. I can also verify that the right image is being displayed (by checking the link).

    Is there a way to force Woocommerce to just display the image “as is” since I know it fits?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support mouli


    This is largely controlled by your theme.
    To test this I suggest that you change the theme to a default such as TwentyNineteen or [Storefront]( (which is a free theme from and test to see if that solves the issue.

    You can often fix this issue using some CSS added to your Additional CSS field in the Customizer.
    If you’d like help with this, please can you send a link to a product page where we can see this issue for ourselves.

    We look forward to hearing back from you.


    Thanks for your response.

    It actually happens in Storefront, too. So I just addressed the issue by using a program outside of WordPress to convert all my images to square. Now even giant images (2048 x 2048) will get a thumbnail that has the correct aspect ratio.

    I think the issue was that every plugin I was testing references the woocommerce_gallery_thumbnail image and that needs to be square (from what I can tell).


Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.