WC_Admin_Webhooks::get_topic_data( WC_Webhook $webhook )

Get the webhook topic data.


Description Description


Parameters Parameters

$webhook

(Required) Webhook instance.


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/admin/class-wc-admin-webhooks.php

	public static function get_topic_data( $webhook ) {
		$topic    = $webhook->get_topic();
		$event    = '';
		$resource = '';

		if ( $topic ) {
			list( $resource, $event ) = explode( '.', $topic );

			if ( 'action' === $resource ) {
				$topic = 'action';
			} elseif ( ! in_array( $resource, array( 'coupon', 'customer', 'order', 'product' ), true ) ) {
				$topic = 'custom';
			}
		}

		return array(
			'topic'    => $topic,
			'event'    => $event,
			'resource' => $resource,
		);
	}

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.