WC_Webhook::get_topic_hooks
Get the associated hook names for a topic.
Method of the class: WC_Webhook{}
Hooks from the method
Returns
Array.
Usage
// private - for code of main (parent) class only $result = $this->get_topic_hooks( $topic );
- $topic(string) (required)
- Topic name.
Changelog
| Since 2.2.0 | Introduced. |
WC_Webhook::get_topic_hooks() WC Webhook::get topic hooks code WC 10.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();
}