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?
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 :)
Related
I need to prevent the new "Your "shopname" account has been created!" email that gets sent when creating a user via the WooCommerce V3 REST API.
Do not send Woocommerce new customer email if a condition is true
Unfortunately that does not work in V3. The mail is still sent.
Has anyone been able to achieve this? There is no documentation about it. I need to create a custom email for users added in this way.
Was searching for this as well and removing the corresponding action woocommerce_created_customer_notification does the trick:
<?php
function disable_account_creation_email($email_class) {
remove_action('woocommerce_created_customer_notification', array($email_class, 'customer_new_account'), 10, 3);
}
add_action('woocommerce_email', 'disable_account_creation_email');
I need first name in email new account template [woocommerce]
my code -> https://pastebin.com/iTfM6Nmz
WooCommerce doesn't have this functionality built in. The new account email can be sent before an order is placed, which would mean it's before any user information has been captured like first name.
After an order has been placed and you have billing information, then you could pull it in with something like
"Hi" . $order->billing_first_name . "Your recent order on"
But that would be on order confirmation emails, or anything after account creation.
You could also check out this thread: https://wordpress.org/support/topic/how-to-add-customer-name-to-new-customer-admin-order-email/
It's essentially recommending the Follow Up Emails extension to help customize emails. Again it will struggle if the user hasn't added their account information when they register, though, so you might want to look for a way to require filling in WooCommerce user information during registration, assuming it's separate from the purchase flow.
I am a Wordpress developer using a plugin called MemberMouse and got a task that whenever a user signup using MemberMouse sign up form it fires an verification email to the new registered user.
I was asked to do it with the smart tags provided by MemberMouse.
As I read out the plugin's documentation I do not find any smart tag that perform this type of action. Is there any way to make this verification thing work?
I tried to figure it out myself. It could only be done by writing a custom code for it in Wordpress that triggers mail after user becomes a Member.
I am using the Gravity Forms API to manually add entries to a form I've created. According to the docs, the triggers that would normally send the notification emails to both admins and users are not fired:
Intended to be used for importing an entry object. The usual hooks that are triggered while saving entries are not fired here.
Does anyone know how I could programmatically trigger these notifications?
Thanks!
You're looking for GFCommon::send_notification. There's a tutorial with a code example.
I'm trying to implement a plugin in Moodle where new users are registered using Paypal.
And the registration for the new users will require paypal payment to complete registration.
If anybody can help me with any example, code, plugin, or any link, I'll be grateful.
PayPal enrollment is included as part of Moodle's core code, so you just need to enable and then configure it. Documentation is here. This covers enrollment in a specific course, rather than new user signup as typically people want to charge different amounts for different courses, rather than a flat rate for access to everything.
There is no existing PayPal authentication plugin to make it so that a user must pay to register on the site, but if you want to make one the developer docs are here.