How to remove payment method from woocommerce admin email

1.9k views Asked by At

Cannot find how to remove payment method from woocommerce admin email. Searched through the files for Payment Method, but no luck

1

There are 1 answers

0
Yuriy Buha On

First of all, if you haven't done so, copy your woocommerce template files to your themes root as described in http://docs.woothemes.com/document/template-structure/. Then, open a file that is responsible for building the email template. In my case it was (after copying it over) /wp-content/themes/MY_THEME/woocommerce/emails/admin-new-order.php Find the following lines of code

<tfoot>
    <?php
        if ( $totals = $order->get_order_item_totals() ) {
            $i = 0;
            foreach ( $totals as $total ) {
                $i++;
                ?><tr>
                    <th scope="row" colspan="2" style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
                    <td style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
                </tr><?php
            }
        }
    ?>
</tfoot>

And add a condition to check if one of the labels contains Payment Method, like so

<tfoot>
    <?php
        if ( $totals = $order->get_order_item_totals() ) {
            $i = 0;
            foreach ( $totals as $total ) {
                $i++;
                if ( $total['label'] != 'Payment Method:' ){
                    ?><tr>
                        <th scope="row" colspan="2" style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['label']; ?></th>
                        <td style="text-align:left; border: 1px solid #eee; <?php if ( $i == 1 ) echo 'border-top-width: 4px;'; ?>"><?php echo $total['value']; ?></td>
                    </tr><?php
                }
            }
        }
    ?>
</tfoot>

You can use this for other fields also