Skip to content

Instantly share code, notes, and snippets.

@madeincosmos
Created March 27, 2018 15:18
Show Gist options
  • Save madeincosmos/85b0fdaa84912e583dadcbd183ff3ea0 to your computer and use it in GitHub Desktop.
Save madeincosmos/85b0fdaa84912e583dadcbd183ff3ea0 to your computer and use it in GitHub Desktop.
Make all product images in WooCommerce 3.3 square and cropped
function woo_custom_single_image_size ( $size ) {
$size['height'] = $size['width'];
$size['crop'] = 1;
return $size;
}
add_filter('woocommerce_get_image_size_single', 'woo_custom_single_image_size', 50, 1);
add_filter('woocommerce_get_image_size_shop_single', 'woo_custom_single_image_size', 50, 1);
add_filter('woocommerce_get_image_size_thumbnail', 'woo_custom_single_image_size', 50, 1);
add_filter('woocommerce_get_image_size_gallery_thumbnail', 'woo_custom_single_image_size', 50, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment