Reputation: 41
I've been struggling for more than 4 days to customize my small WooCommerce shop email template by wanting to add the following requisites - order number, order date and hour when the order was mode.
This is the email template:
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/*
* @hooked WC_Emails::email_header() Output the email header
*/
do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<?php /* translators: %s: Customer first name */ ?>
<p><?php printf( esc_html__( 'Hi %s,', 'woocommerce' ), esc_html( $order->get_formatted_billing_full_name() ) ); ?></p>
<p><?php esc_html_e( 'Your order №X from date X hour X was processed. You can track the delivery progress by clicking on the shipping number:', 'woocommerce' ); ?></p>
<blockquote><?php echo wpautop( wptexturize( make_clickable( $customer_note ) ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></blockquote>
<?php
/**
* Show user-defined additional content - this is set in each email's settings.
*/
if ( $additional_content ) {
echo wp_kses_post( wpautop( wptexturize( $additional_content ) ) );
}
/*
* @hooked WC_Emails::email_footer() Output the email footer
*/
do_action( 'woocommerce_email_footer', $email );
Upvotes: 0
Views: 1839
Reputation: 183
You may get values for your needs by following functions
// Get Order ID/Number
$order->get_id();
For Order Dates here are the multiple function with different dates you may use them
// Get Order Dates
$order->get_date_created(); //Order Created Date
$order->get_date_modified(); //Order Modified Date
$order->get_date_completed();//Order Completed Date
$order->get_date_paid(); //Order Paid Date
I hope this helps you
Upvotes: 2