Codeinwp / neve

A fast, lightweight, AMP ready WordPress theme built with speed and usability in mind.
https://themeisle.com/themes/neve/
GNU General Public License v2.0
263 stars 84 forks source link

fix: use `WC_Payment_Gateways` instance #4248

Closed Soare-Robert-Daniel closed 5 months ago

Soare-Robert-Daniel commented 6 months ago

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

Check before Pull Request is ready:

Closes https://github.com/Codeinwp/neve/issues/4244

pirate-bot commented 6 months ago

Plugin build for c37039c9cbf5d0ea327664f354e82285c6ba797a is ready :bellhop_bell:!

pirate-bot commented 5 months ago

:tada: This PR is included in version 3.8.8 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: