Woocommerce电子邮件通知中的样式订单详细信息表
我正在使用WordPress 4.8.1并使用Bridge主题.
我面临一些有关从新订单模板电子邮件中删除价格的问题.
我想删除价格列,但是我删除了总计和小计,但是没有任何东西要删除带有产品的价格列.
I am using WordPress 4.8.1 and using bridge theme.
I am facing some problem regarding removing price from new order template email.
I want to remove price column ,however I removed total and subtotal , but not getting anything to remove price column with products as going through files.
我发现这是来自以下代码:
I have found this is coming from this code:
<?php
echo wc_get_email_order_items( $order, array(
'show_sku' => $sent_to_admin,
'show_image' => false,
'image_size' => array( 32, 32 ),
'plain_text' => $plain_text,
'sent_to_admin' => $sent_to_admin,
) ); ?>
在我已从woocommerce模板文件夹中复制到子主题的email-order-details.php模板中.
In email-order-details.php template which I have copied to my child theme from woocommerce template folder.
但是,如何自定义此钩子'wc_get_email_order_items'或其他任何取消价格的方法?
But , how to customise this hook 'wc_get_email_order_items' or any other way to remove price?
这就是我现在拥有的:
由于我花了很多时间来寻找相同的解决方案,因此我们将不胜感激.
Any help will be appreciated as I have spent so much hours finding solution for same.
1.Template email/email-order-details.php
1.Template email/email-order-details.php
- 您将在第38行删除该块的位置:
<th class="td" scope="col" style="text-align:<?php echo $text_align; ?>;"><?php _e( 'Price', 'woocommerce' ); ?></th>
- 在这里,所有这些都在第50到63行处(要删除):
<tfoot>
<?php
if ( $totals = $order->get_order_item_totals() ) {
$i = 0;
foreach ( $totals as $total ) {
$i++;
?><tr>
<th class="td" scope="row" colspan="2" 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>
2.模板emails/email-order-items.php
.
- 您将在第59行的位置删除此块的地方:
<td class="td" style="text-align:<?php echo $text_align; ?>; vertical-align:middle; border: 1px solid #eee; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;"><?php echo $order->get_formatted_line_subtotal( $item ); ?></td>
所以您会得到这个: