Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing Woocommerce Product Image thumbnail size

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?


1 Answers

There are some hooks available. If you want to change the size using below hook

add_filter( 'wp_get_attachment_image_src', 'your function name', 50, 4 );

Source: https://docs.woocommerce.com/wc-apidocs/hook-docs.html https://businessbloomer.com/woocommerce-visual-hook-guide-single-product-page/

like image 94
RSPR Avatar answered Jan 26 '26 20:01

RSPR



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!