Reputation: 31
I am using woo-commerce theme, in homepage image size criteria is around 234×350 when clicked it will be taken to it's specific page having image size of 450x600.. if user needs to see f in detail user can click the respective image and shown into real 1606×2406 dimension. However, woo-commerce shows the original image size in homepage of 1606x2406 leading to the massive page size. Is there any solution to show smaller dimension of the same image?
Here's the code of fetching image:
<?php foreach($metal_chairs as $key=>$metal):
$series =get_field('series',$metal->ID);
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $metal->ID ), $full_size );
$full_image = wp_get_attachment_image_src( get_post_thumbnail_id( $metal->ID ), 'full' );
$product = wc_get_product( $metal->ID );?>
<div class="product-<?php echo $key+1;?> swiper-slide products">
<a href="<?php echo get_the_permalink($metal->ID);?>" alt="">
<img srcset="<?php echo esc_url($image[0]);?>" src="<?php echo esc_url($image[0]);?>" alt="<?php echo esc_attr($metal->post_title);?>" />
</a>
</div>
Upvotes: 0
Views: 54
Reputation: 141
This call are made by the template itself, not WooCommerce. You need to locate that template file a look at the hook. (This files are usually located at /yourtheme/woocommerce)
You can try changing this
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $metal->ID ), $full_size );
for this
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $metal->ID ), 'thumbnail' );
Upvotes: 1