-
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
Multiple UPE - Duplicate notices when saving SEPA methods #5117
Comments
Hey team! Please add your planning poker estimate with Zenhub @FangedParakeet @timur27 |
@FangedParakeet Your theories are all welcome!
The same is occurring with other test accounts as well. I've checked with |
Did a quick investigation - this hook's callback is being fired N times, where N = size of Since we now have the
I think it would be great to move all the hooks and test them all within this task. Since the fix for this particular issue is a one-liner and we know the place in code where it should be applied, I'd give this issue a Having all this in mind, @mdmoore @FangedParakeet please let me know, which scope you prefer to keep in this issue (move all the hooks, or just the one related to the issue) and please let me know if you would estimate differently or not after this comment. |
Ooh, nice catch! Though, actually now that I look over that code a little closer, won't all of those hooks be defined
This seems like a better long-term solution for now. @timur27, do you have any idea why this was unsuccessful when you attempted it in that merge PR? In terms of weighting the points here, I think the lowest I would go to is a |
Yes. Callback functions in PHP are uniquely hooked to the filter per class instance, which makes sense. I found that out today because of your question - many thanks for asking, as I learned something new today!
I worked with the class' static method only, and I think now that it didn't work because instead of add_action( 'woocommerce_order_payment_status_changed', 'UPE_Payment_Gateway::remove_upe_payment_intent_from_session', 10, 0 ); OR add_action( 'woocommerce_order_payment_status_changed', ['UPE_Payment_Gateway', 'remove_upe_payment_intent_from_session'], 10, 0 ); I passed the callback function like this: add_action( 'woocommerce_order_payment_status_changed', [ UPE_Payment_Gateway::class, 'remove_upe_payment_intent_from_session' ], 10, 0 ); The first two options are the right ways to pass the static class method, according to the documentation. I would expect things to work after trying the correct approach. Also, I am optimistic about moving the non-static methods group to the I am okay with the |
Thanks for all of the research @timur27! I'm fine with widening the scope of this issue to include moving all of the hooks. Given your research and experience with the issue so far, |
This sounds like a cleaner option. You could always just create a private method inside And cool, |
Describe the bug
When adding SEPA payment methods via My Account > Payment Methods > Add Payment Method success notices are duplicated several times.
To Reproduce
poc/upe-instances-multiplied
branch, enable SEPA Direct DebitAcceptance Criteria
poc/upe-instances-multiplied
, not develop.WC_Payments_UPE_Checkout
class and are added to the hook only once.Technical refinement
Please see the discussion below starting from this comment, in order to get an idea of how to achieve the goal of this task.
The text was updated successfully, but these errors were encountered: