简体   繁体   English

更改WooCommerce订单状态更改而无需发送电子邮件通知

[英]Change WooCommerce order status change without sending email notification

I am trying to stop woo-commerce from sending mail when order status is changed. 订单状态更改时,我试图阻止woo-commerce发送邮件。 These orders are of amazon and my plugin syncs it from amazon to woo-commerce. 这些订单来自亚马逊,我的插件将其从亚马逊同步到woo-commerce。 On doing so, mail from both amazon and woo-commerce went, which irritated the clients. 这样一来,来自亚马逊和woo-commerce的邮件就发了起来,这激怒了客户。 So I want to stop email functionality to be stopped when status is changed from my plugin. 所以我想停止在我的插件状态更改后停止电子邮件功能。 the code to change status is 更改状态的代码是

  $WooOrder = wc_get_order($value->post_id);
  $WooOrder->set_address($OrderData['billing'], 'billing')
  $WooOrder->update_status($wooOrderStatus) // $wooOrderStatus is set above

Are there any flags that can be set to avoid sending mails? 是否可以设置任何标志以避免发送邮件?

Any kinds of helps are highly appreciated. 任何帮助都将受到高度赞赏。

Instead of using WC_Order update_status() method, simply use wp_update_post() as follow: 代替使用WC_Order update_status()方法,只需使用wp_update_post() ,如下所示:

$WooOrder = wc_get_order($value->post_id);
$WooOrder->set_address($OrderData['billing'], 'billing');
$WooOrder->save();

// Change order status
wp_update_post(['ID' => $value->post_id, 'post_status' => 'wc-'.$wooOrderStatus]);

This should change the Order status without sending an email notification. 这应该更改订单状态,而不发送电子邮件通知。

Note: Post status for WooCommerce Orders always start with wc- 注意: WooCommerce订单的过帐状态始终以wc-

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 订单状态更改时的 Woocommerce 通知 - Woocommerce notification when order status change 在 Woocommerce 中触发订单自定义状态更改的电子邮件 - Trigger email on order custom status change in Woocommerce 服务器未发送具有47订单状态更改的电子邮件 - server not sending email with virtuemart order status change 在 Woocommerce 中添加自定义订单状态并发送有关状态更改的电子邮件 - Add custom order status and send email on status change in Woocommerce 如何在新订单 WooCommerce 电子邮件通知中将“产品”更改为“服务” - How to change “Product” to “Service” in new order WooCommerce email notification 将WooCommerce处理订单电子邮件通知收件人更改为自定义地址 - Change WooCommerce processing order email notification recipient to a custom address 从 Woocommerce 中的名称更改新订单电子邮件通知 - Change New Order email notification from name in Woocommerce WooCommerce - 发送自定义订单状态更改的自定义电子邮件 - WooCommerce - send custom email on custom order status change 在 WooCommerce 中自定义订单状态更改时发送“保留”email - Send "on hold" email on custom order status change in WooCommerce 通过自定义批量操作处理程序更新时,无需发送确认电子邮件即可将订单状态更改为已确认 - Change Status of Order to Confirmed without Sending Confirmation Email when Updating Via Custom Bulk Action Handler
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM