-
Notifications
You must be signed in to change notification settings - Fork 210
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
Fix excessive emails when enabling the gateway #3695
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
During payment gateway initialization, WC core add hooks that will get triggered when the main gateway is enabled. Use of a centralized option_key for all 'child gateways' makes WC core issue separate email notifications for all of them. To sidestep this problem, with this change we use separate option_id for each child gateway but still use the parent gateways settings when retrieving them. Changes made: - Update get_option_key() to return settings specific to the Stripe ID. - Introduce get_option() method to fetch options from the main Stripe gateway.
Mayisha
approved these changes
Jan 9, 2025
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.
Thanks for the fix @malithsen 👍
- Tested enabling/disabling different payment methods.
- Tested customizing title and description of a payment method.
- Tested enabling/disabling the main Stripe gateway and confirmed that only one email is sent after enabling the gateway.
Before

After

Failing e2e tests and QIT e2e tests don't appear to be related to the changes here. |
hsingyuc
pushed a commit
that referenced
this pull request
Jan 27, 2025
* Fix duplicate emails when enabling the gateway During payment gateway initialization, WC core adds hooks that will get triggered when the main gateway is enabled. Using a centralized option_key for all 'child gateways' makes WC core issue separate email notifications for all of them. To sidestep this problem, with this change, we use separate option_id for each child gateway but still use the parent gateway settings when retrieving them. Changes made: - Update get_option_key() to return settings specific to the Stripe ID. - Introduce get_option() method to fetch options from the main Stripe gateway. --------- Co-authored-by: Mayisha <33387139+Mayisha@users.noreply.github.com>
hsingyuc
added a commit
that referenced
this pull request
Jan 29, 2025
* Lint fixes (#3673) * Lint fixes --------- Co-authored-by: nbloomf <nathan.bloomfield@automattic.com> Co-authored-by: Anne Mirasol <anne.mirasol@automattic.com> * Fix excessive emails when enabling the gateway (#3695) * Fix duplicate emails when enabling the gateway During payment gateway initialization, WC core adds hooks that will get triggered when the main gateway is enabled. Using a centralized option_key for all 'child gateways' makes WC core issue separate email notifications for all of them. To sidestep this problem, with this change, we use separate option_id for each child gateway but still use the parent gateway settings when retrieving them. Changes made: - Update get_option_key() to return settings specific to the Stripe ID. - Introduce get_option() method to fetch options from the main Stripe gateway. --------- Co-authored-by: Mayisha <33387139+Mayisha@users.noreply.github.com> * New headers for changelog and readme files * Update docker-compose cmd to docker compose. (#3709) Co-authored-by: Diego Curbelo <diego@curbelo.com> * Pass total tax amount to metadata * Add changelog entry * Update unit test --------- Co-authored-by: Nathan Bloomfield <nathan.bloomfield@a8c.com> Co-authored-by: nbloomf <nathan.bloomfield@automattic.com> Co-authored-by: Anne Mirasol <anne.mirasol@automattic.com> Co-authored-by: Malith Senaweera <6216000+malithsen@users.noreply.github.com> Co-authored-by: Mayisha <33387139+Mayisha@users.noreply.github.com> Co-authored-by: Wesley Rosa <wesleyjrosa@gmail.com> Co-authored-by: Rafael Zaleski <rafaelzaleski@users.noreply.github.com> Co-authored-by: Diego Curbelo <diego@curbelo.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #3660
Changes proposed in this Pull Request:
During payment gateway initialization, WC core add hooks that will get triggered when the main gateway is enabled. Use of a centralized option_key for all 'child gateways' makes WC core issue separate email notifications for all of them.
To sidestep this problem, with this change, we use separate
option_key
for each child gateway but still use the parent gateways settings when retrieving them.Changes made:
get_option_key()
to return settings specific to the Stripe ID.get_option()
method to fetch options from the main Stripe gateway.Testing instructions
Test emails
WooCommerce
->Settings
->Payments
, toggle the Stripe gateway off and then back on. Make sure only a single email titledPayment gateway "Stripe" enabled
is sent to the admin.Regression tests
changelog.txt
andreadme.txt
(or does not apply)Post merge