• Hello,

    I am triggering woocommerce manually (user is created) like this:

    $wc = new WC_Emails();
    $wc->customer_new_account($user_id);

    However, emails come with two sets of header and footer…
    Like they are wrapped two times. Template files are not touched in the code.

    Is there a way to prevent this?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey,
    I don’t have enough clarity about what you are doing to answer this. If emails are not being double wrapped otherwise my guess is something is not correct in your custom code. For example, if you send a test email from the customizer is that being double wrapped?

    Ben

    Thread Starter Luka Petrovic

    (@lupetalo)

    @britner
    Thanks for checking. All emails (test email included) are working as expected.
    Here is a full code:

    add_action('user_register',function ($user_id){
      $wc = new WC_Emails();
      $wc->customer_new_account($user_id);
    });

    So when a user is created, woocommerce email is sent. If you want to test here are the steps:
    1. WP has to have Woocommerce installed, Kadence plugin active with header and footer setting.
    2. add code above to functions.php
    3. create a user (not via Woocommerce)
    4. user gets double wrapped email

    I did manage to solve it by manually creating a user via wc_create_new_customer rather than hooking to the user_register action.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Manually triggered emails are wrapped two times’ is closed to new replies.