I am customizing the order email template in WooCommerce and need to make "Shipping" second-last in the order details, right above "total".
I know the loop for this is on line 52 in the "email-order-details.php" page from woocommerce>templates>emails, so set it up in my child theme but I'm not sure where to go from there. Here is what I'm trying:
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
}
}
}