0

When a customer has bought an item, WooCommerce automatically sends an email on order status 'complete'. I'm trying to add an image and a link of the purchased product to this email template. The email template is stored as the file customer-completed-order.php.

However, when the test email arrives in my email account, it shows a broken image. I'm not sure what to query to get the permalink for the purchased products, either. I saw this post, which states many (all?) properties for the order object, but not what I'm looking for (I think).

This is the code from my email template:

 <?php
    $order = $order->get_id();
    foreach( $order->get_items() as $item_id => $item ) {
            $product = apply_filters( 'woocommerce_order_item_product', $order->get_product_from_item( $item ), $item );
            echo $product->get_image();
    }
Cinder
  • 319
  • 2
  • 15
  • Instead of editing the template file you could use [Display the product image in Woocommerce email notifications](https://stackoverflow.com/questions/53608751/display-the-product-image-in-woocommerce-email-notifications/53609183#53609183) – 7uc1f3r Sep 17 '20 at 12:04
  • Thank you, that's awesome! I will try it. – Cinder Sep 17 '20 at 12:43

0 Answers0