Skip to content
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

BUG: Invoice email being sent every time check order is saved in "success" status #61

Closed
dparker1005 opened this issue Sep 1, 2021 · 1 comment · Fixed by #94
Closed

Comments

@dparker1005
Copy link
Member

To replicate, create a "Check" order in "Success" status and save it repeatedly. The user associated with the order will receive an Invoice email every time that the order is saved.

This should be addressed in the pmpropbc_send_invoice_email() function here:

/**
* Send Invoice to user if/when changing order status to "success" for Check based payment.
*
* @param MemberOrder $morder - Updated order as it's being saved
*/
function pmpropbc_send_invoice_email( $morder ) {
// Only worry about this if the order status was changed to "success"
if ( 'check' === strtolower( $morder->payment_type ) && 'success' === $morder->status ) {
$recipient = get_user_by( 'ID', $morder->user_id );
$invoice_email = new PMProEmail();
$invoice_email->sendInvoiceEmail( $recipient, $morder );
}
}
add_action( 'pmpro_updated_order', 'pmpropbc_send_invoice_email', 10, 1 );

Suggested fix is to save in order meta when an invoice email has already been sent for a given order, and if that is the case, to not allow another invoice email to be sent.

@cremigerhonig
Copy link

for me no mail is send at all

if I change from pending to sucess there is no mail sent to user, why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants