product image settings woocommerce code example
Example 1: get product image woocommerce
// Use $post->ID to get from post object
$id = $loop->post->ID
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $id ), 'single-post-thumbnail' );
<img src="<?php echo $image[0]; ?>" data-id="<?php echo $id; ?>" />
Example 2: auto images size of woocommerce products
@media (min-width: 768px) {
.inside-wc-product-image {
width: 100%;
}
.woocommerce ul.products li.product a img {
height: 200px; /* adjust height */
object-fit: cover;
}
}