1

I want to send custom email.In that i have to display multiple customers and customers cart items.For that I have created a custom module.In that I have written model to get all the needed data.How can I display the multiple items and multiple customers information in the email template.Thanks in advance.

1 Answer 1

4

To use loop in email templates you need to use a default Magento block.

{{block
class='Magento\\Framework\\View\\Element\\Template'
template='VendorName_ModuleName::email/some-template.phtml'
area='frontend'
customers=$customers
}}

In the created template file you may use the php foreach.

<?php foreach ($block->getData('customers') as $customer): ?>
    <?= $block->escapeHtml($customer->getFirstname()) ?>
<?php endforeach; ?>
0

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.