WC_Webhook::should_deliver()privateWC 2.2.0

Helper to check if the webhook should be delivered, as some hooks. (like wp_trash_post) will fire for every post type, not just ours.

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

Hooks from the method


true|false. True if webhook should be delivered, false otherwise.


// private - for code of main (parent) class only
$result = $this->should_deliver( $arg );
$arg(mixed) (required)
First hook argument.


Since 2.2.0 Introduced.

Code of WC_Webhook::should_deliver() WC 6.8.2

private function should_deliver( $arg ) {
	$should_deliver = $this->is_active() && $this->is_valid_topic() && $this->is_valid_action( $arg ) && $this->is_valid_resource( $arg ) && ! $this->is_already_processed( $arg );

	 * Let other plugins intercept deliver for some messages queue like rabbit/zeromq.
	 * @param bool       $should_deliver True if the webhook should be sent, or false to not send it.
	 * @param WC_Webhook $this The current webhook class.
	 * @param mixed      $arg First hook argument.
	return apply_filters( 'woocommerce_webhook_should_deliver', $should_deliver, $this, $arg );