• Resolved mavv

    (@mavv)


    I am using the BitForm plugin to create a custom registration form with WordPress authentication and email confirmation. This form creates a new WordPress user with the role of “customer” and assigns a custom meta key (bf_activation) with an initial value of 0. Once the user confirms their email address, the plugin updates the meta value from 0 to 1, allowing the user to fully access and use my WooCommerce shop.

    What I need is a way to trigger the default WooCommerce “New User Welcome Email” after the user confirms their email address (i.e., when the meta value changes from 0 to 1). I have already tried several solutions, but I am encountering an issue with email styling.

    Here’s the problem:

    • If I manually trigger the WooCommerce new user email immediately after the user is created by BitForm, the email is sent correctly with the appropriate styling (as I am using Kadence Email Customizer to override default WooCommerce email templates).
    • However, if I trigger the email after the user confirms their email address, the email is sent with broken styling and missing footer content. This seems to happen because WooCommerce is not triggering the full registration process at this stage.

      Exemple

    • 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);
    • }
    • }
    • }

    Could you please help me find a solution to:

    1. Trigger the default WooCommerce “New User Welcome Email” after the user confirms their email address.
    2. Ensure that the email is sent with the correct styling and formatting, as defined by Kadence Email Customizer.

    Thank you for your assistance!

Viewing 5 replies - 1 through 5 (of 5 total)
  • ravindra107

    (@ravindra107)

    Hey @mavv,
    You can check below solution.

    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) {
    $user->set_role('customer');
    do_action('user_register', $user_id);
    }
    }
    }

    If you need anything, feel free to connect with me.

    Best Regards
    Ravindra Singh Meyda

    Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi there!

    Thank you for providing such a detailed explanation of your issue. Since this involves a custom registration process and the use of third-party plugins, I recommend reaching out to the plugin developers (BitForm) for further assistance, as they are best equipped to guide you on integrating their plugin with WooCommerce emails.

    Please note that in this forum, we only provide support related to WooCommerce core functionality, which includes troubleshooting issues when WooCommerce is not working as expected without any custom plugins or customizations.

    If you need more in-depth support or want to consider professional assistance for customization, I can recommend?WooExperts?and?Codeable.io?as options for getting professional help. Alternatively, you can also ask your development questions in the??WooCommerce Community Slack?as custom code falls outside our usual?scope of support.

    Thread Starter mavv

    (@mavv)

    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 4 weeks ago by mavv.
    Thread Starter mavv

    (@mavv)

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

    Plugin Support Moses M. (woo-hc)

    (@mosesmedh)

    Hi @mavv,

    Your request is beyond our support scope since it involves a custom implementation outside the standard WooCommerce registration process.

    I recommend consulting WooExperts or hiring experts from Codeable.io for professional assistance. Alternatively, you can ask your development questions in the WooCommerce Community Slack since custom coding falls outside our usual support scope.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.