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

fix: use WC_Payment_Gateways instance #4248

Merged
merged 1 commit into from
Jun 5, 2024

Conversation

Soare-Robert-Daniel
Copy link
Contributor

@Soare-Robert-Daniel Soare-Robert-Daniel commented Jun 3, 2024

Summary

Because we were using new WC_Payment_Gateways, we added duplicate filters in the loop, which resulted in duplicate behavior when rendering the bank details.

By using the singleton pattern provided by the class via WC_Payment_Gateways:instance(), we prevent this bad behavior.

Debugging process

To find where the problem was, I first printed the stack trace on the function that renders the bank details and then checked all Neve functions that were used. There was nothing problematic with them; there were no multiple calls.

This leads me to the idea that some filter was added multiple times, so I printed the stack trace of the WC_Payment_Gateways constructor, which revealed the Neve function that added the filter multiple times.

Will affect the visual aspect of the product

NO

Screenshots

image

Test instructions

  • Use WooCommerce
  • Activate Direct bank transfer in Payments tab of WooCommerce settings
  • Put some items in the carts and do the checkout.
  • We should see only an instance of bank details displayed.

Check before Pull Request is ready:

Closes #4244

@Soare-Robert-Daniel Soare-Robert-Daniel added the pr-checklist-skip Allow this Pull Request to skip checklist. label Jun 3, 2024
@Soare-Robert-Daniel Soare-Robert-Daniel self-assigned this Jun 3, 2024
@pirate-bot pirate-bot added pr-checklist-complete The Pull Request checklist is complete. (automatic label) labels Jun 3, 2024
@pirate-bot
Copy link
Collaborator

Plugin build for c37039c is ready 🛎️!

@Soare-Robert-Daniel Soare-Robert-Daniel merged commit 78eda64 into development Jun 5, 2024
31 checks passed
@Soare-Robert-Daniel Soare-Robert-Daniel deleted the fix/duplicate-bank-statement branch June 5, 2024 07:58
@Soare-Robert-Daniel Soare-Robert-Daniel mentioned this pull request Jun 5, 2024
@pirate-bot
Copy link
Collaborator

🎉 This PR is included in version 3.8.8 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@pirate-bot pirate-bot added the released Indicate that an issue has been resolved and released in a particular version of the product. label Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-checklist-complete The Pull Request checklist is complete. (automatic label) pr-checklist-skip Allow this Pull Request to skip checklist. released Indicate that an issue has been resolved and released in a particular version of the product.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bank Details are being duplicated on Order-Received Page with Neve Theme
3 participants