• Resolved wp_user1

    (@wp_user1)


    Hey there WooCommerce experts,
    I am trying now for hours, but no idea what’s wrong.

    I simply want to send the WC_Email_New_Order mail manually via source code. I am using this code:

    $post_id=346;$order = wc_get_order( $post_id );$mailer = WC()->mailer();$email = $mailer->emails['WC_Email_New_Order'];$email->trigger( $order->get_id(), $order );

    Nothing happens.
    When using the same code for WC_Email_New_Order everything works fine:

    $post_id = 346; // Order ID$order = wc_get_order($post_id);$mailer = WC()->mailer();$email = $mailer->emails['WC_Email_Customer_Completed_Order'];$email->trigger($order->get_id(), $order);

    Also when sending WC_Email_New_Order again via order details in WordPress backend. So mail configuration, template and recipient are okay.
    Any ideas what could be wrong here? ??

Viewing 1 replies (of 1 total)
  • Plugin Support ckadenge (woo-hc)

    (@ckadenge)

    Hi @wp_user1,

    Hi there,

    Helping out with custom coding of this nature is outside the scope of support that our support staff can help out with here, although I would recommend the following:

    1. Running the exact question you’re asking, along with the code provided, through an AI platform like ChatGPT for recommendations/changes to your code;
    2. Checking whether there are existing plugins in the WordPress plugin repository that might be doing that already.
    3. Joining our WooCommerce Slack community (it does have a developer channel where you can ask coding questions): https://woo.com/community-slack/

    Hope it helps!

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