Я хочу отобразить значение настраиваемого поля в почте заказа, но оно не отображается внутри почты заказа, пока это работает с плагином (WooCommerce Email Test). Каждое значение настраиваемого поля отображается здесь с этим плагином.
Это мой код (внутри email-order-details.php):
<tfoot>
<?php
if ( $totals = $order->get_order_item_totals() ) {
$i = 0;
foreach ( $totals as $total ) {
$i++;
?>
<?php if($total['label'] == "Shipping:" || $total['label'] == "Verzending:"){ ?>
<?php } elseif($total['label'] == "Subtotal:" || $total['label'] == "Subtotaal:") {
$oid = $order->get_id(); ?>
<tr>
<th class="td" scope="row" style="text-align:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo "Subtotaal"; ?></th>
<td class="td" style="text-align:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php $order_st=get_post_meta($oid, 'order_subtotal', true); echo "<span class='woocommerce-Price-currencySymbol'>".get_woocommerce_currency_symbol()."</span>".$order_st."245.00"; ?></td>
</tr>
<?php $trans_method=get_post_meta($oid, 'trans_method', true); if($trans_method == 'pickup'){ ?>
<tr>
<th class="td" scope="row" style="text-align:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo "Transportkosten"; ?></th>
<td class="td" style="text-align:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo "<span class='woocommerce-Price-currencySymbol'>".get_woocommerce_currency_symbol()."</span>0.00"; ?></td>
</tr>
<tr>
<td colspan="2" class="td" style="text-align:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo "Afhalen"; ?></td>
</tr>
<tr>
<th class="td" scope="row" style="text-align:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo "Totaal ex BTW"; ?></th>
<td class="td" style="text-align:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php $teb=get_post_meta($oid, 'order_subtotal', true); echo "<span class='woocommerce-Price-currencySymbol'>".get_woocommerce_currency_symbol()."</span>".$teb; ?></td>
</tr>
<?php } ?>
<?php if($trans_method == 'deliverybypostcode'){ ?>
<tr>
<th class="td" scope="row" style="text-align:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo "Transportkosten"; ?></th>
<td class="td" style="text-align:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><span class="woocommerce-Price-currencySymbol"><?php $transcost=get_post_meta($oid, 'tran_cost', true); echo get_woocommerce_currency_symbol(); ?></span><?php echo money_format("%.2n", $transcost); ?></td>
</tr>
<tr><td colspan="2" class="td" scope="row" style="text-align:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo "Bezorgen op postcode:"; ?> <?php $postcode=get_post_meta($oid, 'trans_location', true);
$place_dis=get_post_meta($oid, 'trans_distance', true);
$mcrane=get_post_meta($oid, 'mounted_crane', true);
echo $postcode[0]." ".$place_dis."</br>";
if($mcrane == "Yes"){
echo "Transport: "."Met autolaadkraan"."</td></tr>";
}else{
echo "Transport: "."Zonder autolaadkraan"."</td></tr>";
} ?>
<tr>
<th class="td" scope="row" style="text-align:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo "Totaal ex BTW"; ?></th>
<td class="td" style="text-align:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php $os_total=get_post_meta($oid, 'order_subtotal', true);
$tcost=get_post_meta($oid, 'tran_cost', true);
$ot_cost=$os_total+money_format("%.2n", $tcost);
echo "<span class='woocommerce-Price-currencySymbol'>".get_woocommerce_currency_symbol()."</span>". money_format("%.2n", $ot_cost); ?></td>
</tr>
<?php } ?>
<?php } elseif($total['label'] == "BTW:"){
$oid1 = $order->get_id();
?>
<tr>
<th class="td" scope="row" 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:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php $ttax = get_post_meta($oid1, 'order_total_tax', true); echo "<span class='woocommerce-Price-currencySymbol'>".get_woocommerce_currency_symbol()."</span>".$ttax; ?></td>
</tr>
<?php } elseif($total['label'] == "Total:" || $total['label'] == "Totaal:"){ ?>
<tr>
<th class="td" scope="row" style="text-align:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo "Totaal incl. BTW"; ?></th>
<td class="td" style="text-align:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo $total['value']; ?></td>
</tr>
<?php }else{ ?>
<tr>
<th class="td" scope="row" 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:<?php echo $text_align; ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo $total['value']; ?></td>
</tr><?php }
}
}
?>
</tfoot>
Пожалуйста, скажите мне, что я делаю не так (просто я хочу отобразить значение настраиваемых полей также внутри почтового заказа)