0
votes

So I have made a custom admin order template ( restyling and re-arranging a lot ) for a online store. I already know about the "show image => false/true" that is not the answer I'm looking for, because I completely changed everything in my email template. Now my problem is that I don't know how to display the product image.

Any help is welcome because I'm new to coding.

Edit: This Is the bug i have right now: <img class="thumb" src="<img" width="1080" height="1080" alt="Weer Thuis Boeket" loading="lazy" srcset="https://acanthusbloememotie.nl/staging/wp-content/uploads/2020/07/14.png 300w, https://acanthusbloememotie.nl/staging/wp-content/uploads/2020/07/14.png 1024w, https://acanthusbloememotie.nl/staging/wp-content/uploads/2020/07/14.png 150w, https://acanthusbloememotie.nl/staging/wp-style="border: none; display: inline-block; font-size: 14px; font-weight: bold; height: auto; outline: none; text-decoration: none; text-transform: capitalize; vertical-align: middle; margin-right: 10px; max-width: 100%;">

Here is my code:

<figure>
    <?php
    foreach ($order->get_items() as $key => $lineItem) {

        //uncomment the following to see the full data
        // echo '<pre>';
        // print_r($lineItem);
        // echo '</pre>';
        $product_id = $lineItem['product_id'];
        $product = wc_get_product( $product_id );
        printf( '<img class="thumb" src=' . $product->get_image('full')  . ' ');
    }
    ?>
</figure>
1
What is the error?GalaxyCat105
<img class="thumb" src="<img" width="1080" height="1080" alt="Weer Thuis Boeket" loading="lazy" srcset="acanthusbloememotie.nl/staging/wp-content/uploads/2020/07/… ">LK-dev
This here above is what i see as a img in my test email pluginLK-dev
Edit your question to include thatGalaxyCat105
Also, use the term "bug" or "unexpected result" to refer to that. "Error" is used to refer to an error thrown by the program.GalaxyCat105

1 Answers

0
votes

This has helped me with my problem, hopefully others can use it too. this gets the URL of the product image. <?php printf( esc_html__(get_the_post_thumbnail_url($product->get_id())));?>