0

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">.

  • You can try this one : magecomp.com/magento-2-product-images-order-view.html – Dhiren Vasoya Aug 1 '20 at 12:16
  • @DhirenVasoya thanks for the reply. I actually trying to send picture in the email, that extension I think is for the customer order view in account panel. – nix Aug 1 '20 at 13:02
  • Ok you can use same concept for the email files which render the product. – Dhiren Vasoya Aug 1 '20 at 13:05
  • @DhirenVasoya please read my question... – nix Aug 1 '20 at 13:06
  • You have put code only for bundle items, you need to put this on all items in generally files. – Dhiren Vasoya Aug 1 '20 at 13:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.