使用信用卡付款向管理员和客户发送电子邮件通知以等待WooCommerce中的待处理订单

时间:2019-02-28 12:06:25

标签: php wordpress woocommerce payment-gateway email-notifications

类似于Send an Email notification to the admin for pending order status in WooCommerce此问题/答案 多亏了LoicTheAztec,这是我在网络上找到的关于这个问题的唯一不错的答案。

现在,我有一个预订网站,我们在该网站上使用WP + Woocommerce解决方案来出售活动。一切都很好,但是... 如果客户下订单并通过银行付款,我们也会收到邮寄订单和客户。 但是,如果使用信用卡付款(Nexi或PostFinance),则不发送邮件。 我们使用了您的(美丽代码),因此现在客户收到两封银行存款邮件和一封信用卡付款邮件。而且我们在接收发送给管理员的邮件时遇到了一些问题。 我不知道我是否清楚,但是如果您有解决方案,我将非常高兴,并且我很乐意为在function.php中插入正确的代码付出一些代价。

我们尝试使用以下代码:

// New order notification only for "Pending" Order status
add_action( 'woocommerce_checkout_order_processed', 'pending_new_order_notification', 20, 1 );
function pending_new_order_notification( $order_id ) {

// Get an instance of the WC_Order object
$order = wc_get_order( $order_id );

// Only for "pending" order status
if( ! $order->has_status( 'pending' ) ) return;

// Send "New Email" notification (to admin)
WC()->mailer()->get_emails()['WC_Email_New_Order']->trigger( $order_id );

}

0 个答案:

没有答案
相关问题