Вам необходимо переопределить поставщика / magento / module-sales / view / frontend / templates / email / items / invoice / default.phtml
Вы можете создать расширение следующим образом. Это моя регистрация.php файл app / code / Jsc / InvoiceEmailJsc / registration.php
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Jsc_InvoiceEmailJsc" setup_version="1.0.0"/>
</config>
Это мой module.xml файл app / code / Jsc / InvoiceEmailJsc / etc / module.xml
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Email Creditmemo Items List" design_abstraction="custom">
<body>
<referenceBlock name="sales.email.order.invoice.renderers">
<block class="Magento\Sales\Block\Order\Email\Items\DefaultItems" as="default" template="Jsc_InvoiceEmailJsc::email/items/invoice/default.phtml"/>
</referenceBlock>
</body>
</page>
Это мой default.phtml app / code / Jsc / InvoiceEmailJsc / view / frontend / templates / email / items / invoice / default.phtml
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
?>
<?php $_item = $block->getItem() ?>
<?php $_order = $block->getItem()->getOrder(); ?>
<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->get('\Magento\Catalog\Model\ProductFactory')->create()->load($_item->getProductId());
?>
<tr>
<td class="item-info<?php if ($block->getItemOptions()): ?> has-extra<?php endif; ?>">
<p class="product-name"><?= $block->escapeHtml($_item->getName()) ?></p>
<p class="sku"><?= /* @escapeNotVerified */ __('SKU') ?>: <?= $block->escapeHtml($block->getSku($_item)) ?></p>
<?php if ($block->getItemOptions()): ?>
<dl>
<?php foreach ($block->getItemOptions() as $option): ?>
<dt><strong><em><?= /* @escapeNotVerified */ $option['label'] ?></em></strong></dt>
<dd>
<?= /* @escapeNotVerified */ nl2br($option['value']) ?>
</dd>
<?php endforeach; ?>
</dl>
<?php endif; ?>
<?php $addInfoBlock = $block->getProductAdditionalInformationBlock(); ?>
<?php if ($addInfoBlock) :?>
<?= $addInfoBlock->setItem($_item->getOrderItem())->toHtml() ?>
<?php endif; ?>
<?php //Your code starts to show custom attribute value ?>
<dl class="item-options">
<dt><?= __('BBD') ?>:</dt>
<dd><?php echo $product->getData('showbbd'); ?></dd>
</dl>
<?php //Your code ends to show custom attribute value ?>
<?= $block->escapeHtml($_item->getDescription()) ?>
</td>
<td class="item-qty"><?= /* @escapeNotVerified */ $_item->getQty() * 1 ?></td>
<td class="item-price">
<?= /* @escapeNotVerified */ $block->getItemPrice($_item) ?>
</td>
</tr>