简体   繁体   English

如何在 Woocommerce 电子邮件模板中添加订单号、订单日期和时间

[英]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.

相关问题 将订单号添加到 WooCommerce 电子邮件正文模板中的字符串 - Add order number to a string in WooCommerce email body template 如何在 WooCommerce 中的已完成订单 email 模板中添加新帐户信息 - How to add new account info on order completed email template in WooCommerce Woocommerce 新订单电子邮件模板 - Woocommerce New Order Email Template 在管理新订单电子邮件模板中添加应用的优惠券代码 - WooCommerce - Add Applied Coupon Code in Admin New Order Email Template - WooCommerce 将列创建日期和订单号添加到 WooCommerce 我的帐户订单 - Add columns date created and order number to WooCommerce My account Orders 如何将产品 SKU 添加到 WooCommerce 新订单电子邮件主题 - How to add product SKUs to WooCommerce new order email subject 如何为 woocommerce 中的新 email 订单添加商品重量? - How to add item weight to new email order in woocommerce? 如何将自定义字段作为抄送添加到 WooCommerce 客户订单电子邮件 - How to add Custom Field as a CC to WooCommerce Customer Order Email 链接 Dokan Woocommerce 电子邮件通知的订单号 - Linking the order number for Dokan Woocommerce email notifications WooCommerce 将订单备注添加到订单已完成的电子邮件 - WooCommerce add order note to orderCompleted email
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM