Woo commerce new user email

偶尔善良 提交于 2021-02-07 14:18:25

问题


I wrote a custom plugin that handles login and registration for my WordPress Woocommerce site.

When a user registers via my custom form handler I would like to trigger Woocommerce to send the new user an email instead of using wp_mail. This way I reduce code redundancy, and all of the transactional emails can be formatted the same (they all have the same look and feel).

Is it possible to do so?


回答1:


Try this:

$wc = new WC_Emails();
$wc->customer_new_account($user_id);

$customerID should be the ID of the newly created customer. Here you can find out everything about the WC_Email_Customer_New_Account class: https://docs.woocommerce.com/wc-apidocs/class-WC_Email_Customer_New_Account.html. Just place this code somewhere where it will run after the customer has been registered, so I assume somewhere where you would have placed the wp_mail functions. Let me know if this helped :)



来源:https://stackoverflow.com/questions/42226823/woo-commerce-new-user-email

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