Use wp_loaded for fraudnet loading to avoid warnings

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"
This commit is contained in:
Alex P 2023-02-08 18:00:23 +02:00
parent 664a53dd36
commit 61dafb83d7
No known key found for this signature in database
GPG key ID: 54487A734A204D71

View file

@ -252,7 +252,7 @@ class WCGatewayModule implements ModuleInterface {
);
add_action(
'init',
'wp_loaded',
function () use ( $c ) {
if ( 'DE' === $c->get( 'api.shop.country' ) ) {
( $c->get( 'wcgateway.pay-upon-invoice' ) )->init();