Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request - Remove lazy loading from main product image #40

Closed
GlueDigiStu opened this issue Sep 13, 2021 · 1 comment
Closed

Request - Remove lazy loading from main product image #40

GlueDigiStu opened this issue Sep 13, 2021 · 1 comment

Comments

@GlueDigiStu
Copy link

Issue: Currently the main product image in the gallery is using Wordpress loading="lazy" default since 5.5 behaviour. This is causing the LCP score in Google Lighthouse to be majorly affected.

Solution: in file wooswipe.php, on line 105 - change the code from

            $image = get_the_post_thumbnail($post->ID, apply_filters('single_product_large_thumbnail_size', 'shop_single'),
                array(
                    'title' => '',
                    'data-hq' => $hq[0],
                    'data-w' => $hq[1],
                    'data-h' => $hq[2],
                )
            );

to

            $image = get_the_post_thumbnail($post->ID, apply_filters('single_product_large_thumbnail_size', 'shop_single'),
                array(
                    'loading' => false,
                    'title' => '',
                    'data-hq' => $hq[0],
                    'data-w' => $hq[1],
                    'data-h' => $hq[2],
                )
            );

Result: My LCP score has dropped from 5s to 3s, and the Performance score from Lighthouse has jumped from 56 to 77.

@kurtisbradley
Copy link
Collaborator

Thanks for pointing that out @GlueDigiStu.

This has been added in Version 1.1.13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants