Style orders details table in Woocommerce email notifications

后端 未结 2 1184
鱼传尺愫
鱼传尺愫 2020-12-29 00:54

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 ,

相关标签:
2条回答
  • 2020-12-29 01:07

    This can be done Overriding the following WooCommerce Templates via a Theme:

    1.Template email/email-order-details.php

    • Where you will remove the block at line 38:
    <th class="td" scope="col" style="text-align:<?php echo $text_align; ?>;"><?php _e( 'Price', 'woocommerce' ); ?></th>
    
    • And here also, all this blocks at line 50 to 63 (to remove):
    <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.Template emails/email-order-items.php.

    • Where you will remove this block at line 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>
    

    So you will get this:

    0 讨论(0)
  • 2020-12-29 01:25

    You have two files to copy, email-order-details.php and email-order-items.php. These two files contains what you want to be removed. email-order-details.php has the <th> tag or the header of the table. And email-order-items.php has the <td> tags. Please check these files out.

    0 讨论(0)
提交回复
热议问题