【问题标题】:Woocommerce - Sending custom email from custom order statusWoocommerce - 从自定义订单状态发送自定义电子邮件
【发布时间】:2016-04-13 05:17:12
【问题描述】:

我是 Wordpress 的新手,我想弄清楚当我的订单状态更改为特定的自定义订单状态时如何发送电子邮件。

这是我的代码:

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' );

当客户的订单状态更改为此自定义订单状态(“已发货”)时,我将如何向客户发送电子邮件?

提前致谢

【问题讨论】:

    标签: wordpress email woocommerce


    【解决方案1】:

    您可以将此插件用于您的解决方案。

    WooCommerce Order Status Change Notifier

    或者

    您可以转到插件settings =&gt; Email tab 并安装(启用)您想要的通知。

    希望对你有帮助

    【讨论】:

    • 订单状态是自定义订单状态,因此不会显示在 woocommerce 设置中的电子邮件选项卡下。该插件是个好主意,但我的客户不想为此付费。 woocommerce 是否没有电子邮件触发器?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-24
    相关资源
    最近更新 更多