1. Home
  2. Help Center
  3. WooCommerce
  4. Shop
  5. Product image sizes

Thumbnail size

It’s possible to control the image size used in the product grid/catalog from the customizer in Appearance > Customize > WooCommerce > Product Images

However, it’s possible to force the values using a filter. Add this snippet to wp-content/themes/goya-child/functions.php

// Set WooCommerce thumbnail size
add_filter( 'woocommerce_get_image_size_thumbnail', function( $size ) {
 return array(
  'width' => 450,
  'height' => 450,
  'crop' => 1,
 );
} );Code language: PHP (php)

The above code indicates that the thumbnails will be cropped to 450x450px, a square crop. But you can use your preferred values for width and height.

Single Product

You can change the size and aspect ratio with the following snippet

add_filter( 'woocommerce_get_image_size_single', function( $size ) {
 return array(
  'width' => 900,
  'height' => 900,
  'crop' => 0,
 );
} );Code language: PHP (php)

The main product image gallery shows full product image, as uploaded, so is always uncropped by default. Use 'crop' => 1 to crop or 'crop' => 0 for the original aspect ratio.

If the images don’t change immediately you can run the built in thumbnail resizing WooCommerce > Status > Tools > Regenerate shop thumbnails or any plugin from the wordpress.org repository.

After all changes purge the entire site cache.

Was this article helpful?

Related Articles