Describe your bug or feature request.

Commerce allows resending of an order receipt mail. Sites may wish to process the resend differently, for example to add a sentence indicating the receipt is a resend.

In OrderReceiptMail::send() we could add an extra optional argument bool $resend, which is used to set an extra 'resend' parameter. In OrderReceiptResendForm we would set this extra argument.

Issue fork commerce-3347295

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

AdamPS created an issue. See original summary.

tBKoT made their first commit to this issue’s fork.

tbkot’s picture

Status: Active » Needs review
jsacksick’s picture

@AdamPS: Oh, thought the "resend" parameter was a concept used elsewhere in core... hm... This is just a flag you're planning on relying on via a hook_mail_alter() or something? I wonder if we should standardize and document the extra parameter in our MailHandlerInterface.

In this case, we might also need to set a default value for it (from the $default_params array).

I also wonder how we can phrase "The indicator to mark send email as it resends." better.

adamps’s picture

Many thanks for the fix and comments. I will test it soon.

This is just a flag you're planning on relying on via a hook_mail_alter() or something?

It would be very useful for Symfony Mailer. In #3271421: Full integration with commerce module we ignore commerce_mail() and instead build the email using the new powerful interfaces and features including "Manage Display" (field formatters) and CSS libraries. The email building code is only about 10 lines.

Specifically, the original mail should be bcc'ed according to store settings, the resend should not, hence this issue. Currently the patch has a workaround checking timestamps to figure it out, which is not ideal😃.

I wonder if we should standardize and document the extra parameter in our MailHandlerInterface.

Sure if you believe it is a standard thing, and other email types can be resent.

I also wonder how we can phrase "The indicator to mark send email as it resends." better.

How about: "Whether the receipt mail is being resent by an administrator."

adamps’s picture

I am keen to discuss strategy for Symfony Mailer + Commerce integration with someone at Commerce Guys.

adamps’s picture

Status: Needs review » Reviewed & tested by the community

Great it works. It would be good to change the comment as suggested in #5/#6.

  • jsacksick committed f2912a44 on 8.x-2.x authored by tBKoT
    Issue #3347295 by tBKoT, jsacksick, AdamPS: Indicate resend of order...

  • jsacksick committed ea63a34a on 3.0.x authored by tBKoT
    Issue #3347295 by tBKoT, jsacksick, AdamPS: Indicate resend of order...
jsacksick’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks!

adamps’s picture

Amazing thanks very much

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.