mavv
Forum Replies Created
-
Thank you, Anthony!
After your advice, I started digging deeper into the FTP files, trying to understand how Kadence was triggered. After 7–8 hours of brainstorming with ChatGPT, DeepSeek, and analyzing FTP files, I finally found a working solution.
The issue was that the email confirmation was not part of the standard WooCommerce registration process. As a result, WC mailing and Kadence weren’t initialized at the moment of the meta key change. The fix was simply to reinitialize them at the right moment.
Really appreciate your guidance—it helped me approach the problem from the right angle!
add_action('updated_user_meta', 'initialize_kadence_email_system', 10, 4);
function initialize_kadence_email_system($meta_id, $user_id, $meta_key, $meta_value) {
if ($meta_key === 'bf_activation' && $meta_value == 1) {
if (class_exists('Kadence_Woomail_Designer')) {
$kadence_woomail = Kadence_Woomail_Designer::get_instance();
$kadence_woomail->on_init();
}
send_wc_new_user_email_notification($user_id);
}
}
function send_wc_new_user_email_notification($user_id) {
if (class_exists('WC_Email_Customer_New_Account')) {
$email = new WC_Email_Customer_New_Account();
$email->email_type = 'html';
$email->trigger($user_id, null, true);
error_log('WooCommerce email triggered for user ID: ' . $user_id);
} else {
error_log('WC_Email_Customer_New_Account class not found.');
}
}Hello @aapc
Thank you for your reply.I use Bitform’s plugin registration form with the WP Auth feature for customer registration. The problem is that if I don’t enable the email confirmation option (and the WC email is sent at the moment of registration), Kadence plugin correctly overrides the WooCommerce new customer email. However, when I enable email confirmation (which is mandatory in the EU), the registration process works differently—users are created as soon as the form is validated, but they can only access the site after confirming their email.
To work around this, I tried using a meta change to trigger the standard WooCommerce email notification, attempting to replicate WooCommerce’s original procedure as closely as possible.
I’ve tested multiple approaches, including
do_action
,wc_mail
, and scripts like this one:add_action('updated_user_meta', 'send_wc_new_user_email_notification', 10, 4);function send_wc_new_user_email_notification($meta_id, $user_id, $meta_key, $meta_value) {
if ($meta_key === 'bf_activation' && $meta_value == 1) {
$user = get_userdata($user_id); // Get user data
do_action('woocommerce_created_customer', $user_id, array(), $user); // Trigger WooCommerce's default email flow
}
}
However, this method seems to be missing something that the Kadence plugin relies on as a trigger to override the email. When triggered this way, the email lacks styling, as well as the header and footer.
Unfortunately, Bitform’s developers haven’t been very cooperative on this issue. However, even if they were, there’s likely nothing they could do, as the problem lies in how the Kadence plugin detects and overrides the WooCommerce email. Since I’m trying to use WooCommerce’s standard email procedure, Kadence should theoretically apply its usual overrides, but for some reason, it doesn’t in this case.Hi Anthony,
Thanks so much for your helpful response! I’ll definitely give it a try with the body classes you mentioned.
I have one more question.
How can I properly trigger the WooCommerce new user email so that Kadence automatically applies its template to it? Or, what hooks does Kadence use to override the default WooCommerce new user email?
Thank you in advance!- This reply was modified 1 month, 1 week ago by mavv.
UPD
So i tried this code using YayMail – WooCommerce Email Customizer, the triggered email has the proper template with a header and footer.add_action('updated_user_meta', 'send_wc_new_user_email_notification', 10, 4);function send_wc_new_user_email_notification($meta_id, $user_id, $meta_key, $meta_value) {
if ($meta_key === 'bf_activation' && $meta_value == 1) {
$user = get_userdata($user_id); // Get user data
do_action('woocommerce_created_customer', $user_id, array(), $user); // Trigger WooCommerce's default email flow
}
}
The issue seems is that the Kadence plugin can’t properly apply the template to a custom triggered default WC new user email using such codes.It’s a pity because I prefer the Kadence Template Builder MUCH more!
- This reply was modified 1 month, 2 weeks ago by mavv.
Thank you very much for your reply. I will consider it as an option, but for now, I am trying to trigger the default WooCommerce new customer email as close as possible to the original procedure so that the Kadence template is applied automatically.
Could you please tell me what conditions the Kadence plugin requires for an email to be considered the ‘default WooCommerce new user email’?
@karlalevelup
Following your advice, I tried this code:add_action(‘updated_user_meta’, ‘send_wc_new_user_email_notification’, 10, 4);
function send_wc_new_user_email_notification($meta_id, $user_id, $meta_key, $meta_value) {
if ($meta_key === ‘bf_activation’ && $meta_value == 1) {
$user = get_userdata($user_id); // Get user data
do_action(‘woocommerce_created_customer’, $user_id, array(), $user); // Trigger WooCommerce’s default email flow
}
}
However, I am still facing the same issue. The email is triggered, but the styles are not applied correctly.When I manually reject and reapprove a user as an admin after the user’s registration, the email is sent with the correct template. But when the email is sent using the trigger above or any other trigger I have tried earlier (triggers that are supposed to send the default WooCommerce new user welcome emai) the template is not applied every time
The issue does not appear to be related to Bitform’s registration form procedure, as the metadata they use seems to work correctly in triggering WooCommerce emails without any problems. Instead, it seems that the Kadence plugin is unable to apply the template to the default WooCommerce new user email when it is triggered using
do_action
or other triggers outside of WooCommerce’s default registration process.Do you have any advice on how to fix this issue?
Thank you in advance!@shahzeenfarooq
Thank you for your suggestion, however despite the plugins I have implemented, my initial question remains: How can I correctly trigger WooCommerce’s “New User Welcome Email” outside of the standard WooCommerce registration process? This functionality is still part of WooCommerce’s default core features.Hello @ravindra107
Thank you for proposed solution.
The code you suggested is one of the first solutions I tried during my initial experiments. Unfortunately, when used after email confirmation, this code does not trigger the WooCommerce welcome email, even when WooCommerce is initialized first.
- This reply was modified 1 month, 2 weeks ago by mavv.
Thank you for your reply I will try to follow your advise and will post later if it will work or not.
Have a nice day/evening!