Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1404081

    Hey Gunter,

    When we use the standard Enfold product image gallery/lightbox for product pages, the single product image and lightbox image loads just fine. But when we switch to using the Woocommerce v3 gallery in the theme settings we have an issue where the single product image size and the lightbox image size can’t be altered independently.

    For example:

    In the Customiser, if we set the Woocommerce main product image to be 600px wide, then the lightbox image only loads at 600px wide. In contrast, every other instance of the lightbox such as using any ALB media element allows us to set an image size for the element, and then it will load in the WordPress Large size (which we have set at 1000px) into the lightbox.

    So the question is – how can we alter the lightbox image size for the Woocommerce v3 product gallery independently to the actual product image on the page?

    Thanks again

    Tim

    • This topic was modified 1 year, 7 months ago by THP Studio.
    #1404452

    Hey Tim,

    Sorry for the late reply again.

    This is caused by WC core limiting the sizes attribute to the image size you select.

    In 5.6 I remove the sizes attribute when opening the lightbox – so the max image size is always used. This is actually a hack but I do not see another workaround.

    I added filter ‘avf_wc_30_gallery_lightbox_use_max_image_size’ to remove this hack again.

    Meanwhile what you can do:

    In enfold\config-woocommerce\woocommerce-mod.js around line 27 you find:

    
    img.trigger('click');
    

    Replace this with:

    
    			let img_tag = img.find( 'img' ).eq(0);
    			if( img_tag.length )
    			{
    				img_tag.removeAttr( 'sizes' );
    			}
    
    img.trigger('click');
    

    As also mentioned in previous post you need to minify this file when using minified or merged js (=> woocommerce-mod.min.js)

    Best regards,
    Günter

    #1404910

    Thanks Gunter, we will wait for 5.6 to test the functionality, but hopefully this does what we need it to, although if it just pulls max size I’m not sure it will. Could it be tweaked a little to allow us to specify an image size to call?

    Regards

    Tim

    #1404945

    Hi Tim,

    I’m afraid there is no easy way at the moment. The whole HTML for the gallery is managed by WC. If you activate a standard theme like twenty twenty three you also only get the maximum image.

    But I will keep it in mind for future.

    Best regards,
    Günter

    #1405001

    Thanks Gunter, appreciate your time.

    We’ll see what we can do with the filter you’ve added in 5.6

    Thanks again.

    Tim.

    #1405240

    Hi,
    Glad Günter was able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Woocommerce v3 Lightbox image size’ is closed to new replies.