From 61dafb83d7c8f7de52abc1288587bcb56a09e0a5 Mon Sep 17 00:00:00 2001 From: Alex P Date: Wed, 8 Feb 2023 18:00:23 +0200 Subject: [PATCH] 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" --- modules/ppcp-wc-gateway/src/WCGatewayModule.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ppcp-wc-gateway/src/WCGatewayModule.php b/modules/ppcp-wc-gateway/src/WCGatewayModule.php index fe0d20d12..ecb4487c8 100644 --- a/modules/ppcp-wc-gateway/src/WCGatewayModule.php +++ b/modules/ppcp-wc-gateway/src/WCGatewayModule.php @@ -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();