Change stock email notifications recipient in WooCommerce

后端 未结 4 1138
小蘑菇
小蘑菇 2021-01-07 07:10

I want to change stock email recipient email address in woocommerce. Already changes admin email but mails are still going to old email.

4条回答
  •  醉梦人生
    2021-01-07 07:14

    To change stock email recipient, try the following:

    add_filter( 'woocommerce_email_recipient_backorder', 'change_stock_email_recipient', 10, 2 ); // For Backorders notification
    add_filter( 'woocommerce_email_recipient_low_stock', 'change_stock_email_recipient', 10, 2 ); // For Low stock notification
    add_filter( 'woocommerce_email_recipient_no_stock', 'change_stock_email_recipient', 10, 2 ); // For No stock notification
    function change_stock_email_recipient( $recipient, $product ) {
        // HERE set your replacement email
        $recipient = 'thename@email.com';
    
        return $recipient;
    }
    

    Code goes on function.php file of your active child theme (or active theme). It should works.

提交回复
热议问题