Magento2 : Order Items Email Template Adjustment
Following steps will be useful
step 1: override the items.phtml code
Path:app/design/frontend/Theme/Magento_Sales/templates/email/items.phtml
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
// @codingStandardsIgnoreFile
?>
<?php $_order = $block->getOrder() ?>
<?php if ($_order): ?>
<?php $_items = $_order->getAllItems();
?>
<table class="email-items" style="width: 650px; text-align="left"">
<tr>
<td style="background-color:#EAEAEA; width: 320px; ">
<?= /* @escapeNotVerified */ __('Items') ?>
</td>
<td style="background-color:#EAEAEA; width: 100px; ">
<?= /* @escapeNotVerified */ __('Sku') ?>
</td>
<td style="background-color:#EAEAEA;width: 100px; ">
<?= /* @escapeNotVerified */ __('Qty') ?>
</td>
<td style="background-color:#EAEAEA; width: 120px;">
<?= /* @escapeNotVerified */ __('Subtotal') ?>
</td>
</tr>
<?php foreach ($_items as $_item): ?>
<?php if (!$_item->getParentItem()) : ?>
<tbody>
<tr>
<td class="item-info">
<?= /* @escapeNotVerified */ $_item->getName()?>
<table class="item-info">
<?php
$options = $_item->getProductOptions();
$s="";
$d="";
if (isset($options['options']) ) {
foreach ($options['options'] as $option) {
$s= $option['label'];
$d= $option['value'];
}
}
?>
<tr class="item-price">
<td class="item-price"><?= /* @escapeNotVerified */ $s?></td>
</tr>
<tr class="item-price">
<td class="item-price"><?= /* @escapeNotVerified */ $d?></td>
</tr>
</table>
</td>
<td class="item-qty">
<?= /* @escapeNotVerified */ $_item->getSku() ?>
</td>
<td class="item-price">
<?= /* @escapeNotVerified */ $_item->getQtyOrdered() ?>
</td>
<td class="item-sku">
<?= /* @escapeNotVerified */ $_item->getPrice() ?>
</td>
</tr>
</tbody>
<?php endif; ?>
<?php endforeach; ?></table>
<table align="right" style="border-collapse: separate;
border-spacing: 0 1em; width: 650px;">
<tr>
<td align="right"><?= /* @escapeNotVerified */ __('Subtotal') ?></td>
<td align="right"> <?= /* @escapeNotVerified */ $_order->getSubtotal() ?></td>
</tr>
<tr>
<td align="right"><?= /* @escapeNotVerified */ __('Shipping & Handling') ?></td>
<td align="right"><?= /* @escapeNotVerified */ $_order->getShippingAmount() ?></td>
</tr>
<tr>
<td align="right"><?= /* @escapeNotVerified */ __('Tax') ?></td>
<td align="right"><?= /* @escapeNotVerified */ $_order->getTaxAmount() ?></td>
</tr>
<tr>
<th align="right"><?= /* @escapeNotVerified */ __('Grant total') ?></th>
<th align="right"><?= /* @escapeNotVerified */ $_order->getGrandTotal() ?></th>
</tr>
</table>
<?php if ($this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order', $_order, $_order->getStore()) && $_order->getGiftMessageId()): ?>
<?php $_giftMessage = $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessage($_order->getGiftMessageId()); ?>
<?php if ($_giftMessage): ?>
<br />
<table class="message-gift">
<tr>
<td>
<h3><?= /* @escapeNotVerified */ __('Gift Message for this Order') ?></h3>
<strong><?= /* @escapeNotVerified */ __('From:') ?></strong> <?= $block->escapeHtml($_giftMessage->getSender()) ?>
<br /><strong><?= /* @escapeNotVerified */ __('To:') ?></strong> <?= $block->escapeHtml($_giftMessage->getRecipient()) ?>
<br /><strong><?= /* @escapeNotVerified */ __('Message:') ?></strong>
<br /><?= $block->escapeHtml($_giftMessage->getMessage()) ?>
</td>
</tr>
</table>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
It will works like a charm.
I have got this work, I have changed few things & now tis worked for me. Thanks @arun.
<?php $_order = $block->getOrder() ?>
<?php if ($_order): ?>
<?php $_items = $_order->getAllItems(); ?>
<table class="email-items" cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">
<thead>
<tr>
<th class="item-info" align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">
<?= /* @escapeNotVerified */ __('Items') ?>
</th>
<th class="item-qty" align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">
<?= /* @escapeNotVerified */ __('Qty') ?>
</th>
<th class="item-price" align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">
<?= /* @escapeNotVerified */ __('Price') ?>
</th>
</tr>
</thead>
<?php foreach ($_items as $_item): ?>
<?php if (!$_item->getParentItem()) : ?>
<tbody>
<?= $block->getItemHtml($_item) ?>
</tbody>
<?php endif; ?>
<?php endforeach; ?>
<tfoot class="order-totals">
<tr class="subtotal">
<th style="padding-right:20px;" align="right" colspan="2" scope="row">
<?= /* @escapeNotVerified */ __('Subtotal') ?>
</th>
<td>
<span class="price">Rs: <?= /* @escapeNotVerified */ $_order->getSubtotal() ?></span>
</td>
</tr>
<tr class="shipping">
<th style="padding-right:20px;" align="right" colspan="2" scope="row">
<?= /* @escapeNotVerified */ __('Shipping & Handling') ?>
</th>
<td>
<span class="price">Rs: <?= /* @escapeNotVerified */ $_order->getShippingAmount() ?></span>
</td>
</tr>
<tr class="grand_total">
<th style="padding-right:20px;" align="right" colspan="2" scope="row">
<strong><?= /* @escapeNotVerified */ __('Grant total') ?></strong>
</th>
<td>
<strong><span class="price">Rs: <?= /* @escapeNotVerified */ $_order->getGrandTotal() ?></span></strong>
</td>
</tr>
</tfoot>
</table>
<?php if ($this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order', $_order, $_order->getStore()) && $_order->getGiftMessageId()): ?>
<?php $_giftMessage = $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessage($_order->getGiftMessageId()); ?>
<?php if ($_giftMessage): ?>
<br />
<table class="message-gift">
<tr>
<td>
<h3><?= /* @escapeNotVerified */ __('Gift Message for this Order') ?></h3>
<strong><?= /* @escapeNotVerified */ __('From:') ?></strong> <?= $block->escapeHtml($_giftMessage->getSender()) ?>
<br /><strong><?= /* @escapeNotVerified */ __('To:') ?></strong> <?= $block->escapeHtml($_giftMessage->getRecipient()) ?>
<br /><strong><?= /* @escapeNotVerified */ __('Message:') ?></strong>
<br /><?= $block->escapeHtml($_giftMessage->getMessage()) ?>
</td>
</tr>
</table>
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>