我在我的WooCommerce安装中创建了一个名为Quote的自定义订单状态.
/*
* Change order status on new orders depending on order contents:
* If any product in the order is availble for quote, return 'quote' status.
* Otherwise the order status will be set to processing.
*/
add_filter ('woocommerce_payment_complete_order_status', 'change_status_to_quote_if_applicable', 10, 2);
function change_status_to_quote_if_applicable($order_status, $order_id) {
$order = new WC_Order($order_id);
$items = $order->get_items();
foreach ($items as $item) {
$product = get_product($item['product_id']);
if(product_available_for_quote($product)){
return 'quote';
}
}
return $order_status;
}
Run Code Online (Sandbox Code Playgroud)
现在,我想在收到已收到状态报价的订单时收到一封电子邮件.我根据这篇有用的文章创建了一个插件:http://www.skyverge.com/blog/how-to-add-a-custom-woocommerce-email/
我的插件基本上都是从文章中复制过来的,我刚刚更改了电子邮件的内容.我想改变的是触发电子邮件的原因.
文章中的插件有:
// Trigger on new …Run Code Online (Sandbox Code Playgroud) woocommerce ×1