• Resolved vviinnkkoo

    (@vviinnkkoo)


    Hello,

    so I’ve been exploring what happens under the hood, and I noticed that when I have a variable product, next thing happens…

    Default featured product image is displayed as webp. When I click on the variable product, any of them, image that is displayed on the screen is regular jpeg. It’s webp counterpart exists in the files, as I tried to manually type .webp at the end of image.

    I provided a link where I tested this, but it happens on any variable product. I’m using Breakdance pagebuilder.

    From what I’ve noticed, image is loaded after I click on the variable button via jquerry.zoom.js., which is made by Woocommerce.

    Is there a way to force dynamically loaded images to also be served as webp?

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support qtwrk

    (@qtwrk)

    <IfModule LiteSpeed>
    RewriteCond %{HTTP_ACCEPT} "image/webp"
    RewriteCond %{REQUEST_FILENAME}.webp -f
    RewriteRule ^(.*).(jpg|jpeg|png|gif) $1.$2.webp [T=image/webp,L]
    </IfModule>

    you can try this workaround , it will force load webp if possible

    Thread Starter vviinnkkoo

    (@vviinnkkoo)

    Tried this, added to the htaccess, it’s still the same on variable product images. I think it’s because images are dinamically loaded with JavaScript. Tried some other approaches like adding more attributes to “WebP Attribute To Replace” in the Image optimization settings, same result.

    I believe that problem lies in the way images are prepared to be loaded.

    JSON data from all product images has .jpeg as image source, so I think it wouldn’t be possible to serve webp image without changing the JSON source first.

    Plugin Support qtwrk

    (@qtwrk)

    no , with the rewrite rule trick, as long as that image is on your server, and webp exists, it doesn’t matter loaded by html or js or css , it will get webp

    please share me some example image that you think it should be webp but it wasn’t

    • This reply was modified 4 months, 2 weeks ago by qtwrk.
    Thread Starter vviinnkkoo

    (@vviinnkkoo)

    Sure, here is the one product example:

    Variable product example

    When you inspect or open in new tab default product image that has big number 2 on it, it is WEBP image.

    When you click on either product 1 or 2, and then inspect image, it will be an JPG image.

    For example, this is the image that gets loaded for me: JPG image

    But it’s WEBP version of that same image also exists on the server: WEBP image link

    This only happens with variable products. Products that have multiple images stored as “featured image” that are loaded on page open are all WEBP – like this one: Product with featured images

    • This reply was modified 4 months, 2 weeks ago by vviinnkkoo.
    Plugin Support qtwrk

    (@qtwrk)

    it is , with rewrite rule trick , the URI won’t change, but content type will be webp if webp available

    Thread Starter vviinnkkoo

    (@vviinnkkoo)

    Oh I see! I apologise, didn’t know that was a thing. It was probably working like that from the start, but I didn’t pay attention to content type.

    Thank you very much for clarification.

    Much appreciated.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.