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

Use wp_loaded for fraudnet loading to avoid warnings #1172

Merged
merged 1 commit into from
Feb 13, 2023

Conversation

AlexP11223
Copy link
Contributor

It needs wcgateway.enabled-ppcp-gateways which calls WC()->payment_gateways->get_available_payment_gateways(), and the hooks inside it can be used by other plugins resulting in warnings about calling functions like get_cart too early.

One way to fix it is simply to use the wp_loaded hook instead of init, I think it supposed to be a more correct choice if interaction with other plugins (WC) is needed, because it is fired when "WP, all plugins, and the theme are fully loaded and instantiated"

It needs wcgateway.enabled-ppcp-gateways which calls WC()->payment_gateways->get_available_payment_gateways(), and the hooks inside it can be used by other plugins resulting in warnings about calling functions like get_cart too early
One way to fix it is simply to use the wp_loaded hook instead of init, I think it supposed to be a more correct choice if interaction with other plugins (WC) is needed, because it is fired when "WP, all plugins, and the theme are fully loaded and instantiated"
@Dinamiko Dinamiko merged commit 36281f4 into trunk Feb 13, 2023
@Dinamiko Dinamiko deleted the PCP-1438-get-cart-warning branch February 13, 2023 14:15
@Dinamiko Dinamiko added this to the 2.0.3 milestone Feb 21, 2023
@Dinamiko Dinamiko added the enhancement New feature or request label Feb 21, 2023
@Dinamiko Dinamiko mentioned this pull request Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants