• mavv

    (@mavv)


    Hello,
    I use BitForm’s registration form with the wp_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!

    • This topic was modified 1 month ago by mavv.
    • This topic was modified 1 month ago by mavv.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support karlalevelup

    (@karlalevelup)

    Hi there!

    Glad you reached out to us.

    Your custom function manually triggers the WC_Email_Customer_New_Account email, which might bypass the WooCommerce email system.

    Instead of manually calling $email->trigger(), try using WooCommerce’s built-in action:

    do_action('woocommerce_created_customer', $user_id, $user);

    This should ensure WooCommerce handles the email and our Email Designer plugin to apply its customization.

    I hope this gives you an idea on how to execute your customization better. You may also reach out to a developer who could update your code to make it work as you would want it.

    Thread Starter mavv

    (@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!

    Thread Starter mavv

    (@mavv)

    @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!

    • This reply was modified 3 weeks, 5 days ago by mavv. Reason: minor text changes
    • This reply was modified 3 weeks, 5 days ago by mavv. Reason: minor text changes
    Plugin Support karlalevelup

    (@karlalevelup)

    Hi there.

    This customization is out of scope, but here’s another idea – since the default WooCommerce template is used, try overriding it on your child theme/theme.

    Copy the template from our plugin and override the template for new user registration on your theme files. This way, even if the default template is used by the plugin, it will still use the hooks from our Email Designer plugin.

    Otherwise, I strongly recommend that you consult a developer with the best code snippet to trigger the emails the way you want them.

    Thread Starter mavv

    (@mavv)

    @karlalevelup

    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’?

    Thread Starter mavv

    (@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 3 weeks, 4 days ago by mavv.
Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.