【问题标题】:WooCommerce automatically sending cancelled orders emailWooCommerce 自动发送取消的订单电子邮件
【发布时间】:2017-03-15 12:54:08
【问题描述】:

我收到了五封取消通知电子邮件,几乎都是在同一时间,但都没有取消他们的订单。我打电话给每一位客户,他们都告诉我他们没有取消订单。订单实际上并未在 Wordpress 中取消,但出于某种原因,已发送取消电子邮件通知。

请帮我解决这个问题。

谢谢!

【问题讨论】:

  • 您使用一些插件来发送电子邮件?都是更新、主题和插件吗?此人已购买?

标签: wordpress email woocommerce cancellation


【解决方案1】:
add_action("woocommerce_order_status_changed", "my_custom_notification");

function my_custom_notification($order_id, $checkout=null) {
   global $woocommerce;
   $order = new WC_Order( $order_id );
   if($order->status === 'cancelled' ) {
      // Create a mailer
      $mailer = $woocommerce->mailer();

      $message_body = __( 'Hello world!!!' );

      $message = $mailer->wrap_message(
        // Message head and message body.
        sprintf( __( 'Order %s received' ), $order->get_order_number() ), $message_body );

      // Cliente email, email subject and message.
     $mailer->send( $order->billing_email, sprintf( __( 'Order %s received' ), $order->get_order_number() ), $message );
     }

   }

您可以设置自己的订单取消通知邮件(订单状态更改为已取消)

【讨论】:

    猜你喜欢
    • 2016-02-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-24
    • 1970-01-01
    • 2019-06-10
    • 2017-08-08
    • 2019-01-09
    相关资源
    最近更新 更多