Merge pull request #839 from woocommerce/PCP-782-resubscribe-webhooks-on-plugin-upgrades

Resubscribe the WebHooks after updating plugin to newer version.
This commit is contained in:
Emili Castells 2022-09-29 09:35:49 +02:00 committed by GitHub
commit 33bd09e745
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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();
}
);
}
);
}
/**