[英]How to Add Order Number, Order Date and Hour in a Woocommerce Email Template
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.我一直在努力定制我的小型 WooCommerce 商店电子邮件模板超过 4 天,希望添加以下必要条件 - 订单号、订单日期和订单模式时的时间。
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 );
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我希望这可以帮助你
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.