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');
我會如何時,他們的訂單狀態更改爲(「運」)這個定製訂單狀態發送電子郵件給客戶?
在此先感謝
訂單狀態是一個定製的訂單狀態,因此不會在woocommerce設置電子郵件選項卡下顯示。該插件是一個好主意,但我的客戶不想爲此付費。 woocommerce沒有電子郵件觸發器嗎? –
好的,我會試着找到解決方案...所以要耐心等待:) – deemi