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?
Next, go to MailPoet > Emails and hit “Add New.” Choose “Welcome Email” from the available options. On the next page, you'll be asked when you want to send your welcome email and which list you want to send to. Select the options that suit your needs and click “Next.”
Simply head to WooCommerce » Settings from your WordPress admin panel and then click the 'Email' tab. Here you'll see all the emails WooCommerce sends to your customers, including emails for new orders, canceled orders, failed orders, orders refunded, password reset, new accounts, and more.
The easiest way to disable the new user notification email in Wordpress is to use the Manage Notification E-mails plugin. This plugin will allow you to disable a slew of admin related emails. After installing and activating the plugin you'll see a new option in your settings for “Notification e-mails”.
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 :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With