2016-04-13 81 views
1

我是新来的Wordpress,我试图找出当我的订单状态更改为特定的自定义订单状态时如何发送电子邮件。Woocommerce - 从自定义订单状态发送自定义电子邮件

这里是我的代码:

function register_awaiting_shipment_order_status() { 
register_post_status('wc-awaiting-shipment', array(
    'label'      => 'Shipped', 
    'public'     => true, 
    'exclude_from_search'  => false, 
    'show_in_admin_all_list' => true, 
    'show_in_admin_status_list' => true, 
    'label_count'    => _n_noop('Awaiting shipment <span  class="count">(%s)</span>', 'Awaiting shipment <span class="count">(%s) </span>') 
)); 
} 
add_action('init', 'register_awaiting_shipment_order_status'); 

// Add to list of WC Order statuses 
function add_awaiting_shipment_to_order_statuses($order_statuses) { 

$new_order_statuses = array(); 

// add new order status after processing 
foreach ($order_statuses as $key => $status) { 

    $new_order_statuses[ $key ] = $status; 

    if ('wc-processing' === $key) { 
     $new_order_statuses['wc-awaiting-shipment'] = 'Shipped'; 
     // WC()->mailer()->emails['wc-awaiting-shipment']->trigger($order_id); 
    } 
} 

return $new_order_statuses; 
} 
add_filter('wc_order_statuses', 'add_awaiting_shipment_to_order_statuses'); 

我会如何时,他们的订单状态更改为(“运”)这个定制订单状态发送电子邮件给客户?

在此先感谢

回答

1

您可以使用此插件为您的解决方案。

WooCommerce Order Status Change Notifier

或者

你可以去插件settings => Email tab和安装(启用)要通知。

希望这将帮助你

+0

订单状态是一个定制的订单状态,因此不会在woocommerce设置电子邮件选项卡下显示。该插件是一个好主意,但我的客户不想为此付费。 woocommerce没有电子邮件触发器吗? –

+0

好的,我会试着找到解决方案...所以要耐心等待:) – deemi

相关问题