This is my observer from where i am passing product name,prodcut price and product quantity in my custom email template file email_template.html .
$templateVars = array( 'store' => $this->storeManager->getStore(), 'order' => $order, 'items'=> $items, 'productName'=>$productName, 'productPrice'=>$productPrice, 'productQuantity'=>$productQuantity, 'payment_html' => $this->getPaymentHtml($order), 'formattedShippingAddress' => $this->getFormattedShippingAddress($order), 'formattedBillingAddress' => $this->getFormattedBillingAddress($order), ); $from = array('email' => "[email protected]", 'name' => 'Ramkishan'); $this->inlineTranslation->suspend(); $to = array($customerEmail); $transport = $this->_transportBuilder->setTemplateIdentifier('order_template') ->setTemplateOptions($templateOptions) ->setTemplateVars($templateVars) ->setFrom($from) ->addTo($to) ->getTransport(); $transport->sendMessage(); $this->inlineTranslation->resume(); In my email_template.html
<table class="email-items"> {{layout handle="email_product_list" items=$items area="frontend"}} </table> email_product_list.xml
product.phtml
<?php $_items = $block->getItems() ?> <table class="email-items"> <thead> <tr> <th class="item-info"> <?= /* @escapeNotVerified */ __('Items'); ?> </th> <th class="item-qty"> <?= /* @escapeNotVerified */ __('Qty'); ?> </th> <th class="item-price"> <?= /* @escapeNotVerified */ __('Price'); ?> </th> </tr> </thead> <tbody> <?php foreach ($_items as $_item): ?> <tr> <td><?php $_item->getName() ?></td> <td><?php $_item->getSku() ?></td> <td><?php $_item->getPrice() ?></td> </tr> <?php endforeach; ?> </tbody> </table> what i am doing wrong ?
array([some] => Your product Name)