Provide a way to suppress the receipt email when admins place orders

Created on 22 April 2022, over 3 years ago
Updated 8 August 2025, 8 days ago

The Order module includes an event subscriber that sends a receipt email when an order is placed. Whether or not it gets sent is based on the configuration of the order type. However, we have a merchant who would still like to automate the sending of emails during checkout but not necessarily when an administrator creates and places an order. They've requested some way to make that behavior optional.

If I had my druthers, we'd use the "Place order" modal dialog, adding a checkbox that reads "Email customer@example.com a receipt after placing the order." It would default to checked or unchecked based on the setting of the order type.

What I don't know is how we actually surface that information through to the subscriber. Any thoughts?

Feature request
Status

Needs work

Version

3.0

Component

Order

Created by

🇺🇸United States rszrama

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇱Israel jsacksick

    Reviving this, let's create an MR, we also need tests.

    Let's unset the data flag to make it more like a per request flag instead of a global flag that wouldn't allow resending the order receipt manually.
    We can unset the flag from the order receipt subscriber.
    I'm also wondering if we should update the order type method to check for the order flag as well, but the method doesn't accept an order, so that would be a breaking change.

  • 🇳🇴Norway zaporylie

    One more note here because something similar came up in one of the projects I've been working on recently. In their case, some orders would be created programmatically, and in such a case, all following messaging is supposed to be suppressed. So in that case, the flag would have to be permanent.

    So my proposal here is to change from using Boolean values to have a helpful CONST defined on the MailerHelper and have the possibility to set skip_order_receipt to PERMANENT, and in such a case, do not reset the value. We could also use that value to hide the action link. Furthermore commerce_shipping could take advantage and suppress shipment confirmation if needed (TBD).

  • 🇮🇱Israel jsacksick

    I'm not particularly in favor of making the flag permanent, as you'd never be able to send the email from the UI. Plus you might need to use the order receipt resend form to send the order to another email (once that feature lands, See Allow specifying an email to send the order receipt to Active ).

    If you're explicitly opening the form to resend a receipt, we shouldn't prevent the user from doing that. By MailerHelper are you referring to the OrderReceiptMail service?

    Also if we make the flag a non boolean and it can support more than 2 states, we should probably make it an enum.

    But maybe we'd need a more global flag that'd be respected by commerce_shipping too for the shipment confirmation (instead of having a separate flag for this).

    So in this case, we'd be more looking at a flag that can be set for programmatically placed orders I suppose, rather than what we're trying to solve here (i.e. the place transition applied from the UI);

Production build 0.71.5 2024