Error filtering template: Warning: Invalid argument supplied for foreach() in /var/www/html/magento2/app/code/Vendorname/Modulename/view/frontend/templates/email_items.phtml on line 10

<?php $items = $block->getItemDetails() ?>
<?php foreach ($items as $key => $itemName): ?>
        <td><?php echo $key; ?></td>
        <td><?= $itemName ?></td>
<?php endforeach; ?>

1 Answer 1


It appears that your variable $items isn't an array. What does the method getItemDetails return? What kind of class is $block?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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