What hook to change thumbnails size in WooCommerce product loops

Viewed 609

I am using Woocommerce. I have added some products to linked products and that is displaying below the details of the single product as a "You may also like…" and I am getting below output

enter image description here

Now, My issue is, I am getting the 150*150 size of images. I have to display the actual size of the images.

@LoicTheAztec I tried the below link as you suggested

Customizing loop product image via a hook in Woocommerce

and I changed from $size = 'woocommerce_thumbnail'; to $size = 'size-woocommerce_thumbnail'; and it's displaying the actual size of images. Is this the correct way to do it?

remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
add_action( 'woocommerce_before_shop_loop_item_title', 'custom_loop_product_thumbnail', 10 );
function custom_loop_product_thumbnail() {
    global $product;
    $size = 'size-woocommerce_thumbnail';

    $image_size = apply_filters( 'single_product_archive_thumbnail_size', $size );

    echo $product ? $product->get_image( $image_size ) : '';
}
0 Answers
Related