Skip to content

Instantly share code, notes, and snippets.

@doubleedesign
Created March 4, 2018 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doubleedesign/21bdfcb89622b99ac318494053cf9eff to your computer and use it in GitHub Desktop.
Save doubleedesign/21bdfcb89622b99ac318494053cf9eff to your computer and use it in GitHub Desktop.
Customise width and height of WooCommerce images since the way it handles images changed in 3.3. More detail on these filters at https://github.com/woocommerce/woocommerce/wiki/Customizing-image-sizes-in-3.3
<?php
// Customise the product image and gallery thumbnail to ensure they match
function doublee_custom_woo_images() {
return array(
'width' => 600,
'height' => 476,
'crop' => 1,
);
}
add_filter( 'woocommerce_get_image_size_gallery_thumbnail', 'doublee_custom_woo_images' );
add_filter( 'woocommerce_get_image_size_thumbnail', 'doublee_custom_woo_images' );
add_filter( 'woocommerce_get_image_size_single', 'doublee_custom_woo_images' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment