cancel
Showing results for 
Search instead for 
Did you mean: 

Product's price per unit to /Magento_Sales/templates/email/items/invoice/default.phtml

Product's price per unit to /Magento_Sales/templates/email/items/invoice/default.phtml

I'm trying to show product price per unit in this file as a new column / TD. How do I get the price per unit?

app/design/frontend/PACKAGE/THEME/Magento_Sales/templates/email/items/invoice/default.phtml

 

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
?>
<?php $_item = $block->getItem() ?>
<?php $_order = $block->getItem()->getOrder(); ?>
<tr>
    <td class="item-info<?= ($block->getItemOptions() ? ' has-extra' : '') ?>">
        <p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p>
        <p class="sku"><?= $block->escapeHtml(__('SKU')) ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p>
        <?php if ($block->getItemOptions()) : ?>
            <dl>
                <?php foreach ($block->getItemOptions() as $option) : ?>
                    <dt><strong><em><?= $block->escapeHtml($option['label']) ?></em></strong></dt>
                    <dd>
                        <?= /* @noEscape */  nl2br($block->escapeHtml($option['value'])) ?>
                    </dd>
                <?php endforeach; ?>
            </dl>
        <?php endif; ?>
        <?php $addInfoBlock = $block->getProductAdditionalInformationBlock(); ?>
        <?php if ($addInfoBlock) : ?>
            <?= $addInfoBlock->setItem($_item->getOrderItem())->toHtml() ?>
        <?php endif; ?>
        <?= $block->escapeHtml($_item->getDescription()) ?>
    </td>
    <td class="item-qty"><?= (float) $_item->getQty() ?></td>
    <td class="item-price">
        <?= /* @noEscape */ $block->getItemPrice($_item->getOrderItem()) ?>
    </td>
</tr>