【问题标题】:Remove the shipping row from the order table in Woocommerce email notifications从 Woocommerce 电子邮件通知中的订单表中删除运输行
【发布时间】:2018-05-15 16:33:54
【问题描述】:

在 WooCommerce 中,我试图从电子邮件通知中的订单表中删除运输行。

我搜索了很多,但没有找到方法。

任何帮助都将不胜感激。

【问题讨论】:

  • 您查看过模板文件吗?常识决定了你会拥有。
  • 我查看了模板文件@ProEvilz。事实上,我已经使用模板做了很多更改,但没有找到在表格中隐藏运输标签的解决方案。

标签: php wordpress woocommerce shipping email-notifications


【解决方案1】:

Overriding woocommerce templates via the theme,删除电子邮件通知中的运输行可以很容易地向emails/email-order-details.php 模板添加一些代码。

这是从 line 51 开始的摘录。因此,您将使用以下代码替换所有代码 beetwen html 打开<tfoot> 标签和关闭</tfoot> 标签:

        <tfoot>
            <?php
                if ( $totals = $order->get_order_item_totals() ) {
                    $i = 0;
                    foreach ( $totals as $key_total => $total ) {
                        $i++;
                        if( $key_total != 'shipping' ):
                        ?><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
                        endif;
                    }
                }
                if ( $order->get_customer_note() ) {
                    ?><tr>
                        <th class="td" scope="row" colspan="2" style="text-align:<?php echo $text_align; ?>;"><?php _e( 'Note:', 'woocommerce' ); ?></th>
                        <td class="td" style="text-align:<?php echo $text_align; ?>;"><?php echo wptexturize( $order->get_customer_note() ); ?></td>
                    </tr><?php
                }
            ?>
        </tfoot>

这是经过测试并且有效的。所以你会得到类似(没有发货行)

【讨论】:

    猜你喜欢
    • 2019-04-18
    • 1970-01-01
    • 2017-09-16
    • 2017-12-15
    • 1970-01-01
    • 1970-01-01
    • 2019-03-17
    • 2018-10-17
    • 2018-01-12
    相关资源
    最近更新 更多