Reputation:
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?
Upvotes: 3
Views: 9670
Reputation: 318
The correct snippet:
add_filter( 'woocommerce_get_image_size_gallery_thumbnail', function( $size ) {
return 'thumbnail'; //replace 'thumbnail' with required size name or array()
} );
Upvotes: -1
Reputation: 142
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/
Upvotes: 1
Reputation: 1005
I would do it using CSS, setting a specific size for the cart page:
table.shop_table img {
width: 100px;
height: 100px;
}
Upvotes: 0