WC_Webhook::get_topic_hooks()privateWC 2.2.0

Get the associated hook names for a topic.

Метод класса: WC_Webhook{}

Хуки из метода

Возвращает

Массив.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->get_topic_hooks( $topic );
$topic(строка) (обязательный)
Topic name.

Список изменений

С версии 2.2.0 Введена.

Код WC_Webhook::get_topic_hooks() WC 8.7.0

private function get_topic_hooks( $topic ) {
	$topic_hooks = array(
		'coupon.created'   => array(
			'woocommerce_process_shop_coupon_meta',
			'woocommerce_new_coupon',
		),
		'coupon.updated'   => array(
			'woocommerce_process_shop_coupon_meta',
			'woocommerce_update_coupon',
		),
		'coupon.deleted'   => array(
			'wp_trash_post',
		),
		'coupon.restored'  => array(
			'untrashed_post',
		),
		'customer.created' => array(
			'user_register',
			'woocommerce_created_customer',
			'woocommerce_new_customer',
		),
		'customer.updated' => array(
			'profile_update',
			'woocommerce_update_customer',
		),
		'customer.deleted' => array(
			'delete_user',
		),
		'order.created'    => array(
			'woocommerce_new_order',
		),
		'order.updated'    => array(
			'woocommerce_update_order',
			'woocommerce_order_refunded',
		),
		'order.deleted'    => array(
			'wp_trash_post',
			'woocommerce_trash_order',
		),
		'order.restored'   => array(
			'untrashed_post',
			'woocommerce_untrash_order',
		),
		'product.created'  => array(
			'woocommerce_process_product_meta',
			'woocommerce_new_product',
			'woocommerce_new_product_variation',
		),
		'product.updated'  => array(
			'woocommerce_process_product_meta',
			'woocommerce_update_product',
			'woocommerce_update_product_variation',
		),
		'product.deleted'  => array(
			'wp_trash_post',
		),
		'product.restored' => array(
			'untrashed_post',
		),
	);

	$topic_hooks = apply_filters( 'woocommerce_webhook_topic_hooks', $topic_hooks, $this );

	return isset( $topic_hooks[ $topic ] ) ? $topic_hooks[ $topic ] : array();
}