• Resolved crdunst

    (@crdunst)


    Hi guys, my client has really large images uploaded and lightbox enabled, so when visitors click on a product image, there’s a long delay before the high res version is displayed.

    Do you know if there’s a way to change the lightbox image from ‘full’ to ‘large’ for example? Do you have a function or filter that could change this?

    Thanks.

    https://www.ads-software.com/plugins/woocommerce/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter crdunst

    (@crdunst)

    If it helps anyone else, there doesn’t seem to be a filter for this, but you can copy the \single-product\product-image.php template into your theme, and edit it as follows:

    Replace

    $image_link = wp_get_attachment_url( get_post_thumbnail_id() );

    With

    $image_link_array = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large' );
    $image_link = $image_link_array[0];

    Just replace the ‘large’ image size with whichever size you want to use.

    Well done, Mr Dunst, you are a gentleman indeed.

    All that needs to be added is that the same thing needs to be done on the product-thumbnails.php template.

    Many thanks for the lead.

    I have applied it on African Scarves

    Update: Not quite the same for product-thumbnails.php:

    /**
    * Get WooCommerce to use "large" images in the lightbox instead of the originals.
    * Replace $image_link = wp_get_attachment_url( $attachment_id ); with the following two lines.
    */
    $image_link_array = wp_get_attachment_image_src($attachment_id, 'large');
    $image_link = $image_link_array[0];
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Changing lightbox image size’ is closed to new replies.