微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – Woocommerce电子邮件通知中的样式订单详细信息表

我正在使用wordpress 4.8.1并使用网桥主题.
关于从新订单模板电子邮件删除价格,我遇到了一些问题.
我想删除价格列,但我删除了总计和小计,但没有得到任何东西来删除产品的价格列作为通过文件.

我发现这来自这段代码

 <?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,
            ) ); ?>

在email-order-details.PHP模板中,我已经从woocommerce模板文件夹复制到我的子主题.

但是,如何自定义此挂钩’wc_get_email_order_items’或任何其他方式来删除价格?

这就是我现在拥有的:

enter image description here

任何帮助将不胜感激,因为我花了这么多时间寻找解决方案.

解决方法:

这可以完成Overriding the following WooCommerce Templates via a Theme

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.模板电子邮件/ 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>

所以你会得到这个:

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐