diff --git a/modules/ppcp-webhooks/factories.php b/modules/ppcp-webhooks/factories.php index 6d36ae4fa..e568b896a 100644 --- a/modules/ppcp-webhooks/factories.php +++ b/modules/ppcp-webhooks/factories.php @@ -10,7 +10,6 @@ declare(strict_types=1); namespace WooCommerce\PayPalCommerce\Webhooks; use WooCommerce\PayPalCommerce\ApiClient\Endpoint\WebhookEndpoint; -use WooCommerce\PayPalCommerce\Onboarding\State; use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface; return array( @@ -18,8 +17,9 @@ return array( $endpoint = $container->get( 'api.endpoint.webhook' ); assert( $endpoint instanceof WebhookEndpoint ); - $state = $container->get( 'onboarding.state' ); - if ( $state->current_state() >= State::STATE_ONBOARDED ) { + $is_connected = $container->get( 'settings.flag.is-connected' ); + + if ( $is_connected ) { return $endpoint->list(); }