Automattic\WooCommerce\Internal\Utilities

WebhookUtil::get_webhook_ids_for_userprivateWC 1.0

Get the ids of the webhooks assigned to a given user.

Method of the class: WebhookUtil{}

No Hooks.

Returns

Int[]. Array of webhook ids.

Usage

// private - for code of main (parent) class only
$result = $this->get_webhook_ids_for_user( $user_id ): array;
$user_id(int) (required)
User id.

WebhookUtil::get_webhook_ids_for_user() code WC 9.9.5

private function get_webhook_ids_for_user( int $user_id ): array {
	$data_store = \WC_Data_Store::load( 'webhook' );
	return $data_store->search_webhooks(
		array(
			'user_id' => $user_id,
		)
	);
}