WC_Webhook::failed_delivery
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.
Method of the class: WC_Webhook{}
Hooks from the method
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->failed_delivery();
Changelog
| Since 2.2.0 | Introduced. |
WC_Webhook::failed_delivery() WC Webhook::failed delivery code WC 10.7.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 );
}
if ( 0 !== $this->get_id() ) {
$this->save();
}
}