Changing Woocommerce Product Image thumbnail size

Viewed 5706

I want to make the gallery thumbnails on the Woocommerce single product page the same size as my main product image. I know I can set the size with this

add_filter( 'woocommerce_get_image_size_gallery_thumbnail', function($size ) {
    return array(
        'width' => 487,
        'height' => 487,
        'crop' => 0,
    );
}); 

But I would like to keep small 100x100x Woo thumbnails for the cart page. I read in the Woo docs that you can change which image sized is being used, so I tried

add_filter( 'woocommerce_gallery_thumbnail_size', function( $size ) {
return 'woocommerce_single';
});

but this is not working. Any thoughts why?

3 Answers

I would do it using CSS, setting a specific size for the cart page:

table.shop_table img {
    width: 100px;
    height: 100px;
}

The correct snippet:

add_filter( 'woocommerce_get_image_size_gallery_thumbnail', function( $size ) {
    return 'thumbnail'; //replace 'thumbnail' with required size name or array()
} );
Related