Unable to add Product image in New order Email Magento 2.3.5

by nix   Last Updated August 01, 2020 09:09 AM - source

I have tried below 2 solutions:

  1. Get product image for invoice email in magento 2.3

  2. (Solved) Magento 2, Add product image in all transaction emails(shipment, invoice, credit memo)

I am using Claue theme, I pasted the below code in invoice/default.phtml & order/default.phtml, then did a setup:static-content:deploy -f. Created new Order, but I do not see the product image in email only the items as shown in the image below.

PATH:

app/design/frontend/Mgs/claue/Magento_Bundle/templates/email/order/items/order

CODE:

<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product_id = $_item->getProductId();
$product = $objectManager->get('Magento\Catalog\Model\Product')->load($product_id);

$_imagehelper = $objectManager->get('Magento\Catalog\Helper\Image');
$image_url = $_imagehelper->init($product, 'cart_page_product_thumbnail')->getUrl();
?>
<img src="<?php echo $image_url ; ?>" alt="<?php echo $product->getName(); ?>" />

This is what I see in email:

enter image description here

I am using Magento 2.3.5-p1, I am not sure if I am pasting the code in correct block. I pasted it below <tr class="bundle-item bundle-parent"> and above <td class="item-info">.



Related Questions



How to send product images through mail

Updated May 25, 2016 08:03 AM

Resize image getMediaUrl

Updated March 22, 2017 23:09 PM

Magento 1.8 Order mail product image not appear

Updated May 17, 2017 07:09 AM