Skip to content

Instantly share code, notes, and snippets.

@topmask
Forked from pinalj/custom-item-email-plain.php
Created October 29, 2021 13:53
Show Gist options
  • Save topmask/9811ba910d00ea4ecc6f20eb75d0a864 to your computer and use it in GitHub Desktop.
Save topmask/9811ba910d00ea4ecc6f20eb75d0a864 to your computer and use it in GitHub Desktop.
Plain Email Template
<?php
/**
* Admin new order email
*/
$order = new WC_order( $item_data->order_id );
echo "= " . $email_heading . " =\n\n";
$opening_paragraph = __( 'A new order has been made by %s. The details of the item are as follows:', 'custom-email' );
$billing_first_name = ( version_compare( WOOCOMMERCE_VERSION, "3.0.0" ) < 0 ) ? $order->billing_first_name : $order->get_billing_first_name();
$billing_last_name = ( version_compare( WOOCOMMERCE_VERSION, "3.0.0" ) < 0 ) ? $order->billing_last_name : $order->get_billing_last_name();
if ( $order && $billing_first_name && $billing_last_name ) {
echo sprintf( $opening_paragraph, $billing_first_name . ' ' . $billing_last_name ) . "\n\n";
}
echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";
echo sprintf( __( 'Ordered Product: %s', 'custom-email' ), $item_data->product_title ) . "\n";
echo sprintf( __( 'Quantity: %s', 'custom-email' ), $item_data->qty ) . "\n";
echo sprintf( __( 'Total: %s', 'custom-email' ), $item_data->total ) . "\n";
echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";
echo __( 'This is a custom email sent as the order status has been changed to Pending Payment.', 'custom-email' ) . "\n\n";
echo apply_filters( 'woocommerce_email_footer_text', get_option( 'woocommerce_email_footer_text' ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment