Change stock email notifications recipient in WooCommerce

我与影子孤独终老i 提交于 2020-01-14 06:55:08

问题


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


回答1:


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.




回答2:


This can be set at the Woocommerce settings page.

Admin -> Woocommerce -> Settings -> Products -> Inventory

Its a bit hidden but its there.




回答3:


This apparently has to be done in the database directly as there is no backend option to change this and woocommerce apparently simply uses the admin e-mail address from the time it's installed. simply search the table wp_options (or different if you chose another prefix than wp_ for your tables) for the option_name: woocommerce_stock_email_recipient and change it to the new one.



来源:https://stackoverflow.com/questions/54904838/change-stock-email-notifications-recipient-in-woocommerce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!