[英]Add an order note to customers when they approve their orders in WooCommerce
In WooCommerce, Allow customer to change order status in WooCommerce answer to my previous question, allows the customer to approve (complete) orders in "My Account" page, but I don't know how to add a note automatically, so when the Customer approves an order (order status is changed to completed), I want to automatically add a note for customer.在 WooCommerce 中, 允许客户在 WooCommerce 中更改订单状态回答我之前的问题,允许客户在“我的帐户”页面中批准(完成)订单,但我不知道如何自动添加注释,所以当客户批准订单(订单状态更改为已完成),我想自动为客户添加备注。
Is it possible to add a Note when customer approve an order and status is changed to "completed"?当客户批准订单并且状态更改为“已完成”时,是否可以添加备注?
If you want an order note for the customer, replace the following code line:如果您想要客户的订单备注,请替换以下代码行:
// Change order status to "completed"
$order->update_status( 'completed', __('Approved by the customer', 'woocommerce') ) ;
by:经过:
// Add an order note for the customer (blue background note in admin orders)
$order->add_order_note( __('You have approved this order on', 'woocommerce') . ' ' . date_i18n( 'F j, Y' ), true );
// Change order status to "completed"
$order->update_status( 'completed', __('Approved by the customer', 'woocommerce') ) ;
WooCommerce Documentation: WC_Order
method add_order_note()
WooCommerce 文档:
WC_Order
方法add_order_note()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.