WordPress at Your Fingertips
function is not described

WC_Webhook::failed_delivery() private WC 2.2.0

Track consecutive delivery failures and automatically disable the webhook. if more than 5 consecutive failures occur. A failure is defined as a. non-2xx response.

{} It's a method of the class: WC_Webhook{}

Return

null. Nothing.

Usage

// private - for code of main (parent) class only
$result = $this->failed_delivery();

Changelog

Since 2.2.0 Introduced.

Code of WC_Webhook::failed_delivery() WC 5.9.0

private function failed_delivery() {
	$failures = $this->get_failure_count();

	if ( $failures > apply_filters( 'woocommerce_max_webhook_delivery_failures', 5 ) ) {
		$this->set_status( 'disabled' );

		do_action( 'woocommerce_webhook_disabled_due_delivery_failures', $this->get_id() );
	} else {
		$this->set_failure_count( ++$failures );
	}

	$this->save();
}