• Resolved IT Hertz

    (@it-hertz)


    Can someone point me to a hook I can use to intercept the resent email and change its subject line and body when an update is performed (e.g., payment method is changed)? I’ve searched the hook library, but didn’t find it.

    I have created custom email templates with php get_meta so that the body data changes in accordance to various functions I’ve added, but I need the resend email to be based upon what occurred in the order update.

    My use case: I have an email that goes out to a bookkeeper after an order is automagically placed when the user fills out a registration form. If the customer makes a mistake, such as selecting the wrong payment method, and the order needs correcting on the back end, the same notification email gets resent on update (or at least the subject is the same). I need to change the email subject and body to give a readily identifiable indication of the reason for this additional email, so that the bookkeeper won’t ignore it as an accidental dupe.

    I can create a dedicated, custom template, if necessary, but I would rather use tags or update_meta_data and get_meta with some if/then blocks to change the email based on what was updated in the order. If I use a completely different template, I will still need to know how to switch the Resend to the secondary custom template instead of the default one.

    I’m hoping there is some kind of woocommerce_before_resend_notification_email action or filter, but I couldn’t find it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @it-hertz

    I understand that you’re looking for a hook to intercept a resent email and modify its subject line and body when an update is performed, such as when the payment method is changed.

    While there isn’t a specific hook named woocommerce_before_resend_notification_email, you can achieve this by using a combination of existing hooks and filters.

    To modify the subject line and body of the email, you can use the woocommerce_email_subject_ and woocommerce_email_heading_ filters.

    Additionally, to dynamically change the body and subject of the email based on what was updated in the order, you can use the woocommerce_update_order action. This action is triggered when an order is updated.

    You can use this action to check what was updated in the order, and then modify the email subject and body accordingly.

    Alternatively, you could also try using some additional plugin such as:

    I hope this helps! If you have any other questions or need further clarification, please don’t hesitate to ask.

    Thread Starter IT Hertz

    (@it-hertz)

    Ok, I’ll try those, thanks.

    Hi @it-hertz

    Ok, I’ll try those, thanks.

    You’re welcome! I’m glad to hear that you found the information helpful. If you run into any issues while implementing these hooks and filters, or if you have any additional questions, don’t hesitate to reach out. We’re here to assist you.

    Remember, the WooCommerce community and documentation are also great resources for finding solutions and learning more about how to customize WooCommerce to fit your specific needs.

    Good luck with your customizations, and I hope everything goes smoothly for you!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Resend new order notification email customization?’ is closed to new replies.