从WooCommerce的电子邮件通知中删除“数量”列

3
在Woocommerce中,我想要像下面截图中那样从电子邮件通知中删除“数量”列: 非常感谢您的帮助。
1个回答

8
这可以通过通过主题覆盖以下WooCommerce模板来完成。
相关的模板是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
  • Change on line 78 <td colspan="3" to <td colspan="2"

  • Remove the following code block from line 66 to 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

  • Change on line 70 <th class="td" scope="row" colspan="2" to <th class="td" scope="row"

  • Change on line 79 <th class="td" scope="row" colspan="2" to <th class="td" scope="row"

  • Remove the code block from line 45:

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

保存这两个模板,完成了…你会得到类似于:

enter image description here


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接