【问题标题】:Remove the column Quantity from email notifications in Woocommerce从 Woocommerce 的电子邮件通知中删除列数量
【发布时间】:2019-03-17 05:27:25
【问题描述】:

在 Woocommerce 中,我想从电子邮件通知中删除 Quantity 列,如下面的屏幕截图所示:

感谢任何帮助。

【问题讨论】:

    标签: php wordpress templates woocommerce email-notifications


    【解决方案1】:

    这可以做到Overriding the following WooCommerce Templates via a Theme

    相关模板email/email-order-items.phpemails/email-order-details.php

    将此模板复制到yourtheme/woocommerce/emails/email-order-items.phpyourtheme/woocommerce/emails/email-order-details.php 后,打开编辑它们:

    1) 对于模板email/email-order-items.php

    • 更改第 78 行 <td colspan="3"<td colspan="2"

    • 删除以下代码块从第 66 行到第 68 行:

      <td class="td" style="text-align:<?php echo esc_attr( $text_align ); ?>; vertical-align:middle; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;">
      <?php echo wp_kses_post( apply_filters( 'woocommerce_email_order_item_quantity', $item->get_quantity(), $item ) ); ?>
      

    2) 对于模板email/email-order-details.php

    • 更改第 70 行 &lt;th class="td" scope="row" colspan="2"&lt;th class="td" scope="row"

    • 更改第 79 行 &lt;th class="td" scope="row" colspan="2"&lt;th class="td" scope="row"

    • 删除第 45 行的代码块:

      <th class="td" scope="col" style="text-align:<?php echo esc_attr( $text_align ); ?>;"><?php esc_html_e( 'Quantity', 'woocommerce' ); ?></th>
      

    保存两个模板,你就完成了……你会得到类似的东西:

    【讨论】:

      猜你喜欢
      • 2018-01-12
      • 2019-04-18
      • 1970-01-01
      • 2017-12-15
      • 1970-01-01
      • 2018-05-15
      • 2018-12-23
      • 2019-04-13
      • 2019-12-15
      相关资源
      最近更新 更多