diff --git a/modules/ppcp-webhooks/src/WebhookModule.php b/modules/ppcp-webhooks/src/WebhookModule.php index 11adb289a..bcfa321c1 100644 --- a/modules/ppcp-webhooks/src/WebhookModule.php +++ b/modules/ppcp-webhooks/src/WebhookModule.php @@ -143,6 +143,21 @@ class WebhookModule implements ModuleInterface { $logger->error( 'Failed to load webhooks list: ' . $exception->getMessage() ); } } + + add_action( + 'woocommerce_paypal_payments_gateway_migrate', + static function () use ( $container ) { + $registrar = $container->get( 'webhook.registrar' ); + assert( $registrar instanceof WebhookRegistrar ); + add_action( + 'init', + function () use ( $registrar ) { + $registrar->unregister(); + $registrar->register(); + } + ); + } + ); } /**