Home Forums WoodMart support forum How to replace with tag for main product image in WoodMart?

How to replace with tag for main product image in WoodMart?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #655062

    LQW
    Participant

    I’m using the WoodMart theme with Elementor and WooCommerce.

    Currently, on single product pages, the main product image is rendered inside a <figure> tag with a data-thumb attribute, and the image itself is inserted dynamically via JavaScript.

    Example output:
    <figure data-thumb=”image-url.jpg” class=”woocommerce-product-gallery__image”></figure>

    This causes the image to not appear as an tag directly in the HTML source, which leads to poor SEO and a lower score in tools like Google PageSpeed (the image is not recognized as LCP).

    What I want to achieve:
    Render the main product image directly in the HTML like this:
    ...

    I already tested that the correct image is loaded when I bypass the JS.
    Is there a setting in WoodMart to force this behavior, or do I need to override a WooCommerce template like product-image.php?

    If yes, which part of the theme controls this rendering?

    Thanks in advance for any help!

    • This topic was modified 1 day, 9 hours ago by LQW.
    • This topic was modified 1 day, 9 hours ago by LQW.
    #655065

    LQW
    Participant

    I’m using the WoodMart theme with Elementor and WooCommerce.

    Currently, on single product pages, the main product image is rendered inside a <figure> tag with a data-thumb attribute, and the actual image is inserted dynamically via JavaScript.

    Example output:

    <figure data-thumb=”image-url.jpg” class=”woocommerce-product-gallery__image”></figure>

    This causes the image not to appear as a proper tag in the HTML source, which negatively impacts SEO and tools like Google PageSpeed (the image is not detected as LCP).

    What I want to achieve:

    I would like the main product image to be rendered directly in HTML like this:

    img src=”image-url.jpg” alt=”…” /

    I already confirmed that the image is correctly loaded when JavaScript is bypassed.

    Question: Is there a setting in WoodMart to achieve this?
    Or do I need to override a WooCommerce template such as product-image.php?
    If so, which part of the theme handles this rendering?

    Thank you for any help!

    #655175

    Luke Nielsen
    Keymaster

    Hello,

    The WooCommerce by default sets such a tag – https://prnt.sc/5o7GWGZ3SSU6

    LCP(Largest Contentful Paint) message doesn’t mean that this particular element is loaded slowly. It just indicates which element is the Larger Contentful Paint. Read more here https://developer.chrome.com/docs/lighthouse/performance/lighthouse-largest-contentful-paint/?utm_source=lighthouse&utm_medium=lr

    Our guide on how to optimize your website using our themes can be found here: https://xtemos.com/wordpress-performance-optimization-the-ultimate-guide-in-2021/.

    Kind Regards

Viewing 3 posts - 1 through 3 (of 3 total)