-
Notifications
You must be signed in to change notification settings - Fork 69
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
Prevent sending shopper emails when disputes are closed #8308
Prevent sending shopper emails when disputes are closed #8308
Conversation
add_filter( 'woocommerce_email_enabled_customer_completed_order', '__return_false' ); | ||
add_filter( 'woocommerce_email_enabled_customer_refunded_order', '__return_false' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered only adding the specific filters inside the if
, but it seemed more readable to me to add and remove both at the same time.
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
Size Change: 0 B Total Size: 1.26 MB ℹ️ View Unchanged
|
Manual testWithout patch
With Patch
Code feedback
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check detailed comment with manual test findings. Looks good.
Fixes #7928
Changes proposed in this Pull Request
When a dispute is created, WooPayments will mark the order as
on-hold
. When the dispute is closed, the order is marked ascompleted
orrefunded
depending on the disputestatus
.The changing of the status to either
refunded
orcompleted
triggers WooCommerce to send an email.refunded
emailcompleted
emailIn both cases, these emails should not be sent. In the case of
completed
the shopper will be confused as to why they are receiving the email.For
refunded
there are some benefits to still sending the email as it will let the shopper know that they are being refunded. However, as this refund is handled by Stripe and the shoppers' bank there may be a delay in receiving it. It is best to allow the shoppers' bank to communicate the dispute outcome.This PR adds a filter to block these emails from being sent as the order status is being changed. This will fix the immediate issue of emails being sent.
Long-term, disputes should have custom statuses. See #8306
Testing instructions
Setup
4000000000002685
(triggersnot received
dispute).Order complete emails
winning_evidence
.Your [STORE] order is now complete
Order refunded emails
losing_evidence
.Your [STORE] order has been refunded
npm run changelog
to add a changelog file, choosepatch
to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge