• Hi there,

    I would like to edit the ‘new order’ woocommerce email to have no body.
    So basically it should only send me the generated PDF and have a Subject.

    I would like to achieve this because i want to automatically print incoming email. But having a body prevents it from only printing the attached file, it also print the body of the email.

    Any help or coding solution would be highly appreciated!

    – David

    yourtheme/woocommerce/emails/admin-new-order.php

    https://www.ads-software.com/plugins/woocommerce/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Caleb Burks

    (@icaleb)

    Automattic Happiness Engineer

    Hey David,

    What hook is your PDF file using to be hooked onto the email?

    You should be able to override this file in your child theme: https://github.com/woothemes/woocommerce/blob/master/templates/emails/admin-new-order.php. More information on how to do this here: https://docs.woothemes.com/document/template-structure/

    Delete out the content hooks, but make sure you keep the hook that is adding in your pdf file.

    You will need to also add in your own header and footer files, ones that exclude the body area: https://github.com/woothemes/woocommerce/blob/master/templates/emails/email-header.php#L30-L66 & https://github.com/woothemes/woocommerce/blob/master/templates/emails/email-footer.php#L24-L59

    Thread Starter daviddol

    (@daviddol)

    Hi there Caleb!

    Thank you so much for taking time to help me out!

    though its been ages since I’ve done some editing, and to be honest I’ve never done any coding really.

    – Where can i see which ‘HOOK’ my pdf using?
    – I’ve added the childtheme/woocommerce/emails/admin-new-order.php directory

    Delete out the content hooks, but make sure you keep the hook that is adding in your pdf file. <- Please some help here, which hooks should i delete?

    This is the code that my woocommerce admin page is using:

    <?php
    /**
    * Admin new order email
    *
    * @author WooThemes
    * @package WooCommerce/Templates/Emails/HTML
    * @version 2.0.0
    */

    if ( ! defined( ‘ABSPATH’ ) ) {
    exit; // Exit if accessed directly
    }

    ?>

    <?php do_action( ‘woocommerce_email_header’, $email_heading ); ?>

    <p><?php printf( __( ‘You have received an order from %s. The order is as follows:’, ‘woocommerce’ ), $order->billing_first_name . ‘ ‘ . $order->billing_last_name ); ?></p>

    <?php do_action( ‘woocommerce_email_before_order_table’, $order, true, false ); ?>

    <h2>id . ‘&action=edit’ ); ?>”><?php printf( __( ‘Order #%s’, ‘woocommerce’), $order->get_order_number() ); ?> (<?php printf( ‘<time datetime=”%s”>%s</time>’, date_i18n( ‘c’, strtotime( $order->order_date ) ), date_i18n( wc_date_format(), strtotime( $order->order_date ) ) ); ?>)</h2>

    <table cellspacing=”0″ cellpadding=”6″ style=”width: 100%; border: 1px solid #eee;” border=”1″ bordercolor=”#eee”>
    <thead>
    <tr>
    <th scope=”col” style=”text-align:left; border: 1px solid #eee;”><?php _e( ‘Product’, ‘woocommerce’ ); ?></th>
    <th scope=”col” style=”text-align:left; border: 1px solid #eee;”><?php _e( ‘Quantity’, ‘woocommerce’ ); ?></th>
    <th scope=”col” style=”text-align:left; border: 1px solid #eee;”><?php _e( ‘Price’, ‘woocommerce’ ); ?></th>
    </tr>
    </thead>
    <tbody>
    <?php echo $order->email_order_items_table( false, true ); ?>
    </tbody>
    <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>
    </table>

    <?php do_action( ‘woocommerce_email_after_order_table’, $order, true, false ); ?>

    <?php do_action( ‘woocommerce_email_order_meta’, $order, true, false ); ?>

    <?php do_action( ‘woocommerce_email_customer_details’, $order, $sent_to_admin, $plain_text ); ?>

    <?php do_action( ‘woocommerce_email_footer’ ); ?>

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    What you pasted is the content of the email – remove what you don’t need.

    Where can i see which ‘HOOK’ my pdf using?

    You’d need to check the source of the plugin you’re using to add PDFs. It may not be any of them. You could just remove the content and see what happens.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘remove body from 'new order' email.’ is closed to new replies.