Skip to content

Duplicate order confirmation emails when checking out with PayPal Express #18838

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
squeegy06 opened this issue Oct 26, 2018 · 9 comments
Closed
Labels
Component: Checkout Event: squashtoberfest Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed

Comments

@squeegy06
Copy link

Preconditions (*)

Magento 2.2.5

Steps to reproduce (*)

  1. Configure Paypal Express as a payment option.
  2. Add items to cart and proceed to checkout as guest or logged in.
  3. Use paypal express as the payment method and complete order.
  4. Observe email.

Expected result (*)

I expected to receive a single order confirmation email.

Actual result (*)

I receive 2 order confirmation emails.

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Oct 26, 2018
@magento-engcom-team
Copy link
Contributor

Hi @squeegy06. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me $VERSION instance

where $VERSION is version tags (starting from 2.2.0+) or develop branches (for example: 2.3-develop).
For more details, please, review the Magento Contributor Assistant documentation.

@squeegy06 do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@webkul-ratnesh
Copy link
Contributor

I would be willing to take on this issue! #SQUASHTOBERFEST

@webkul-ratnesh
Copy link
Contributor

I am unable to reproduce the issue on vanilla magento 2.2.5 and 2.2.6

@ghost ghost self-assigned this Oct 30, 2018
@ghost ghost added Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line labels Oct 30, 2018
@magento-engcom-team
Copy link
Contributor

Hi @engcom-backlog-nazar. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • 6. Add label Issue: Confirmed once verification is complete.

  • 7. Make sure that automatic system confirms that report has been added to the backlog.

@ghost
Copy link

ghost commented Oct 30, 2018

Hi @squeegy06 thank you for you report, this issue has already fixed by this commit -> #15094

@ghost ghost closed this as completed Oct 30, 2018
@squeegy06
Copy link
Author

Sorry if I bothered anyone. I did finally narrow down the module causing the issue and for the sake of anyone else struggling with this and searching around...

We previously had issues (still present in 2.2.5) with confirmation emails missing the FROM, see bug #14952, and as a result we applied this little module https://github.com/pfortin-expertime/MageFix-Misc which had worked nicely until this issue with PayPal.

Thanks again, I do hope this helps someone.

@squeegy06
Copy link
Author

Hello again,

I've had some time to work on this issue, and I'm fairly confident there is an issue here. @engcom-backlog-nazar mentioned this was fixed, but it does not appear that the fix made it into 2.2.5.

So, testing from a fresh install of 2.2.5, when checking out with PayPal, a customer does indeed only get one confirmation email, but it's not because everything functioned correctly, instead a warning is thrown and caught during execution that the "FROM" in the email cannot be set twice, causing the second confirmation that would be sent to fail.

So, this might work, but it's not proper. And this issue is compounded by the fact that a bug is still present in 2.2.5 where the FROM in the email doesn't actually get set in the end. So when we apply a fix found in https://github.com/pfortin-expertime/MageFix-Misc to solve the problem with the FROM not being set, it also stops the warning from being thrown so now when you checkout with PayPal, it sends 2 confirmation emails.

Writing a quick module that replaces the paypal checkout with the fix found in #15094 does ultimately fix all of my issues. But I just want to make someone aware that this issue does not appear to be fixed in 2.2.5

@fwolfst
Copy link

fwolfst commented Mar 3, 2019

I believe the issue ist found in 2.2.7; we observe similar behavior, but cannot confirm the fixes yet (will try).

@rossparachute
Copy link

Hey folks,

Issue Still Persists
For what it's worth, we've encountered this issue today:

  • Magento v2.3.6
  • Magento Paypal v100.3.6.

Possible Causes
The why isn't really 100% clear but it could be related to the order's "email_sent" attribute not being set properly. Which other modules should check for before sending the e-mail via the order sender classes.

Possibly the other code sending the e-mail didn't exist before, necessitating an explicit call in the Magento Paypal code (details below). This may no longer be required.

Quick Fix
An around plugin on this method is clearly the most effective, best-practice solution until the underlying issue is fixed.

If you're in a pinch, commenting out those lines seems is an option too.


Call Details
Call is here:

$this->orderSender->send($order);

if (!$order->getEmailSent()) { $this->orderSender->send($order); }

Inside this method call here you can see the e-mail is sent with:

public function send(Order $order, $forceSyncMode = false)

Which then calls checkAndSend():
https://github.com/magento/magento2/blob/2.3.6/app/code/Magento/Sales/Model/Order/Email/Sender.php#L74

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Checkout Event: squashtoberfest Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed
Projects
None yet
Development

No branches or pull requests

5 participants