Make thumbnails in woocommerce replace the main image instead of opening fancybox

I have just achieved the effect by my own. I will post it here in case others find this thread: jQuery(document).on(‘click’,’.thumbnails .zoom’, function(){ var photo_fullsize = jQuery(this).find(‘img’).attr(‘src’).replace(‘-100×132’,”); jQuery(‘.woocommerce-main-image img’).attr(‘src’, photo_fullsize); return false; }); .replace(‘-100×132’) eliminates the size from url of the image to return the full image and not the thumbnail. Replace it with your … Read more

Thumbnails of same size with different crop

You can define your own cropping sizes but you can create a function that accepts image size + image position and then load your images accordingly. For example- <?php $size=”medium”; $pos = array( ‘top’ => ‘100’, ‘left’ => ‘100’ ); function load_image_with_pos( $img_id, $size, $pos ) { $img_src = wp_get_attachment_image_src( $img_id, $size ); $new_img = … Read more

Is there a hook which fires after all thumbnails are generated?

Thumbnails in WordPress can be generated by using wp_generate_attachment_metadata(), this function fires a filter after generating all the thumbnails wp_generate_attachment_metadata and the filter provides $metadata and $attachment_id to the hooked functions. You can hook your custom function to this filter. $metadata : Attachment metadata. What you need is $metadata[‘sizes’][‘<size-name>’], the <size-name> is the name of … Read more