Kadence styling is not applied if a WooCommerce email is triggered manually
-
Hello,
I use BitForm’s registration form with thewp_auth
option and email verification. Unfortunately, this plugin has an option to send only the WordPress new user welcome email notification once the email is confirmed, but not the WooCommerce new user welcome email.So, I use this snippet:
php
add_action('updated_user_meta', 'send_woocommerce_new_user_email', 10, 4);
function send_woocommerce_new_user_email($meta_id, $user_id, $meta_key, $meta_value) {
if ($meta_key === 'bf_activation' && $meta_value == 1) {
$user = get_userdata($user_id);
if ($user) {
// Trigger WooCommerce "New Account" email
$mailer = WC()->mailer();
$email = $mailer->emails['WC_Email_Customer_New_Account'];
// Manually trigger the email
$email->trigger($user_id, $user);
}
}
}This snippet is intended to trigger the default WooCommerce new user email once the user’s email is confirmed.
However, there’s a catch: If I register as a new user with this snippet active,I receive the default WooCommerce new user email, but without the Kadence template, and it seems the email is missing the default footer. However, if I, as an admin, reject/reapprove the new user (a feature added with BitForm), the new user receives the WooCommerce new user email with the Kadence template.
Please let me know how I could fix this.
Thank you in advance!
- You must be logged in to reply to this topic.