Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter mpweblab

    (@mpweblab)

    Thank you very much for your help and for taking the time to investigate this with me.

    I now understand the intended workflow and can confirm that everything is working as expected on my side.

    Thank you as well for your patience and kindness throughout this discussion. I appreciate the detailed explanations and your assistance in helping me better understand the interaction between WooCommerce and PDF Invoices.

    Have a great day.

    Thread Starter mpweblab

    (@mpweblab)

    Thank you, I think I understand the current behavior now.

    After further testing, I can confirm that the PDF invoice is correctly attached when the order status is changed to “Completed”.

    My concern is therefore no longer really about duplicate emails, but rather about the workflow when working from the order edit page.

    When I complete an order from the orders list screen, the customer receives a single email with the PDF invoice attached, which is exactly the behavior I am looking for.

    However, when working from a specific order page, I end up sending:

    • the WooCommerce “Completed Order” email (with the PDF invoice attached),
    • and then an additional “Order Details” email.

    Technically these are two different emails, but from the customer’s perspective, this can feel like unnecessary email clutter.

    In my business, I mainly work from the individual order page rather than from the orders list screen. That is why I am trying to achieve the same “single email with PDF invoice attached” workflow directly from that interface.

    Is there a recommended workflow for merchants who primarily manage orders from the individual order page and want to ensure that only one customer email is sent when the order is marked as “Completed”?

    Thread Starter mpweblab

    (@mpweblab)

    Thanks for the clarification.

    I performed another test following your recommended workflow.

    When I use only “Save order & send email” from the PDF Invoices metabox:

    • the email is sent,
    • but the order remains in Pending status.

    To actually finalize the order for accounting purposes, I still need to change the order status to Completed afterwards.

    However, when I change the order to Completed, WooCommerce sends the same customer email again.

    So in practice, for this workflow, I always end up with:

    1. one email sent via the PDF Invoices metabox,
    2. one identical WooCommerce completed order email.

    Since my orders need to end in Completed status, I currently do not see a way to avoid sending two identical emails when working from the single order page.

    Interestingly, when I complete orders directly from the orders list screen, this issue does not occur: only one email is sent and the invoice is attached correctly.

    So I wanted to ask: is there an intended workflow or built-in function for this use case (sending the invoice while ending with a Completed order status without sending duplicate customer emails)?

    Thread Starter mpweblab

    (@mpweblab)

    One additional observation that may help isolate the issue:

    The duplicate email never happens when I complete an order directly from the orders list screen.

    I can reproduce it only with this exact workflow:

    1. Open a specific order,
    2. Change the status to Completed,
    3. Use the PDF Invoices metabox action to save and send the email.

    I never click the WooCommerce “Update” button during this process.

    So the duplication appears to happen only from the order edit screen workflow combined with the PDF Invoices email action.

    Thread Starter mpweblab

    (@mpweblab)

    Thanks for your reply.

    To clarify my testing setup and results:

    I performed tests locally using Local Sites on Linux with MailHog for email interception.

    During those tests, Brevo was completely disabled.

    WP Mail SMTP was configured to route emails to MailHog. If I disable WP Mail SMTP in this environment, emails are no longer captured, so that specific test is not meaningful in my local setup.

    To investigate further, I created my own wp_mail logger plugin.

    The result is:

    • only ONE wp_mail() call is logged for the “Customer Completed Order” email;
    • source: WooCommerce (class-wc-email.php);
    • the PDF attachment is already present in that single wp_mail() call.

    However, MailHog receives two identical emails.

    Additionally, I can reproduce the exact same behavior in production:

    • WP Mail SMTP enabled,
    • Brevo SMTP enabled,
    • real mailbox recipient,
    • duplicate emails still received.

    So the issue does not appear to be limited to MailHog or the local environment.

    Based on the wp_mail logs, I currently only see one email generation event, but two deliveries.

    Does PDF Invoices perform any additional processing after wp_mail() is called, or have you seen cases where PDF attachment handling could lead to duplicate delivery?

    I can provide logs if needed.

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