I’m using the latest versions of WordPress and WooCommerce with the latest Flatsome theme. I found an interesting snippet that solves the blur effect issue on product images. However, the code requires some tweaks:
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 = 'woocommerce_thumbnail';
$image_size = apply_filters( 'single_product_archive_thumbnail_size', $size );
echo $product ? $product->get_image( 'full' ) : '';
}
When this code is enabled, the first row displays images in high quality as expected, but there is an additional row of product images that appears at the bottom, which I would like to remove.
Could anyone help me amend the code to remove the extra row of images from the front end?
2
Answers
You should try to use instead
single_product_archive_thumbnail_size
available filter hook that controls the image size used in the product grid/catalog, replacing your current code with:It should better work.
May be the theme has added extra hooks or may be some conflict. But you can try like below just guess. May be it could help.
For more information on customizing image sizes in WooCommerce, please refer to the official documentation here.