Skip to content

Commit ddcceba

Browse files
annemirasolwjrosa
andauthored
Avoid resending Processing Order customer email when merchant wins dispute (#3674)
* Skip 'Processing Order' customer email on merchant dispute win * Add changelog and readme entries --------- Co-authored-by: Wesley Rosa <[email protected]>
1 parent b1421eb commit ddcceba

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*** Changelog ***
22

33
= 9.1.0 - xxxx-xx-xx =
4+
* Tweak - Avoid re-sending Processing Order customer email when merchant wins dispute.
45
* Fix - Allow the saving of iDEAL tokens when SEPA is disabled.
56
* Fix - Fixes the incompatibility notice in editor due missing style property when instantiating Stripe payment methods.
67
* Dev - Updates the GitHub caching action (`actions/cache`) to v4 due deprecation.

includes/class-wc-stripe-webhook-handler.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,19 @@ public function process_webhook_dispute_closed( $notification ) {
400400

401401
// Fail order if dispute is lost, or else revert to pre-dispute status.
402402
$order_status = 'lost' === $status ? 'failed' : $this->get_stripe_order_status_before_hold( $order );
403+
404+
// Do not re-send "Processing Order" email to customer after a dispute win.
405+
if ( 'processing' === $order_status ) {
406+
$emails = WC()->mailer()->get_emails();
407+
if ( isset( $emails['WC_Email_Customer_Processing_Order'] ) ) {
408+
$callback = [ $emails['WC_Email_Customer_Processing_Order'], 'trigger' ];
409+
remove_action(
410+
'woocommerce_order_status_on-hold_to_processing_notification',
411+
$callback
412+
);
413+
}
414+
}
415+
403416
$order->update_status( $order_status, $message );
404417
} else {
405418
$order->add_order_note( $message );

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
111111
== Changelog ==
112112

113113
= 9.1.0 - xxxx-xx-xx =
114+
* Tweak - Avoid re-sending Processing Order customer email when merchant wins dispute.
114115
* Fix - Allow the saving of iDEAL tokens when SEPA is disabled.
115116
* Fix - Fixes the incompatibility notice in editor due missing style property when instantiating Stripe payment methods.
116117
* Dev - Updates the GitHub caching action (`actions/cache`) to v4 due deprecation.

0 commit comments

Comments
 (0)