Knowledge Base

Table of Contents

Updated on May 17, 2023

Single Product image not sharp fix

Problem

In some themes (I’m using Astra theme in this case) the Main image on the single product page are not super crisp. This is because Woocommerce assigns the product image size, not the theme. This is not for all themes, some override the Woocommerce setting, but I needed this fix for Astra theme which rendered the main product images not as crisp as I wanted theme to be.

Solution

Adding this code to your child theme’s functions.php file will force the main product image size to render larger and make them crisp again. The actual product image does not get any larger, but the clarity is perfect as it renders larger than the output.

I’ve left ‘height’ as automatic ‘ ‘ in case the image is not square. Crop is disabled too to enable set it to 1.

/**
 * Single Main image woocommerce_single
 * Fixed pixelated Main single Product image  for woocommerce
 */
add_filter( 'woocommerce_get_image_size_single', function( $size ) {
	return array(
		'width'  => 800,
		'height' => '',
		'crop'   => 0,
	);
} );