【发布时间】:2018-06-05 04:41:02
【问题描述】:
我在 WooCommerce 中自定义订单电子邮件模板,需要在订单详细信息中将“运费”设置在倒数第二位,就在“总计”上方。
我知道这个循环在 woocommerce>templates>emails 的“email-order-details.php”页面的第 52 行,所以在我的子主题中设置它,但我不知道从哪里开始那里。这是我正在尝试的:
if ( $totals = $order->get_order_item_totals() ) {
$i = 0;
foreach ( $totals as $total ) {
$i++;
if($total['label'] === "Shipping"){
//make second-last above total somehow
}
else{
?><tr>
<th class="td" scope="row" colspan="3" style="text-align:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo $total['label']; ?></th>
<td class="td" style="text-align:left; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>" colspan="1"><?php echo $total['value']; ?></td>
</tr><?php
}
}
}
【问题讨论】:
标签: php wordpress woocommerce orders email-notifications