woocommerce_register_post_type_shop_coupon
Использование
add_filter( 'woocommerce_register_post_type_shop_coupon', 'wp_kama_woocommerce_register_post_type_shop_coupon_filter' ); /** * Function for `woocommerce_register_post_type_shop_coupon` filter-hook. * * @param $array * * @return */ function wp_kama_woocommerce_register_post_type_shop_coupon_filter( $array ){ // filter... return $array; }
- $array
- -
Где вызывается хук
woocommerce_register_post_type_shop_coupon
woocommerce/includes/class-wc-post-types.php 522-558
apply_filters( 'woocommerce_register_post_type_shop_coupon', array( 'labels' => array( 'name' => __( 'Coupons', 'woocommerce' ), 'singular_name' => __( 'Coupon', 'woocommerce' ), 'menu_name' => _x( 'Coupons', 'Admin menu name', 'woocommerce' ), 'add_new' => __( 'Add coupon', 'woocommerce' ), 'add_new_item' => __( 'Add new coupon', 'woocommerce' ), 'edit' => __( 'Edit', 'woocommerce' ), 'edit_item' => __( 'Edit coupon', 'woocommerce' ), 'new_item' => __( 'New coupon', 'woocommerce' ), 'view_item' => __( 'View coupon', 'woocommerce' ), 'search_items' => __( 'Search coupons', 'woocommerce' ), 'not_found' => __( 'No coupons found', 'woocommerce' ), 'not_found_in_trash' => __( 'No coupons found in trash', 'woocommerce' ), 'parent' => __( 'Parent coupon', 'woocommerce' ), 'filter_items_list' => __( 'Filter coupons', 'woocommerce' ), 'items_list_navigation' => __( 'Coupons navigation', 'woocommerce' ), 'items_list' => __( 'Coupons list', 'woocommerce' ), ), 'description' => __( 'This is where you can add new coupons that customers can use in your store.', 'woocommerce' ), 'public' => false, 'show_ui' => true, 'capability_type' => 'shop_coupon', 'map_meta_cap' => true, 'publicly_queryable' => false, 'exclude_from_search' => true, 'show_in_menu' => current_user_can( 'edit_others_shop_orders' ) ? 'woocommerce' : true, 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'supports' => array( 'title' ), 'show_in_nav_menus' => false, 'show_in_admin_bar' => true, ) )
Где используется хук в WooCommerce
woocommerce/src/Internal/Admin/Coupons.php 57
add_action( 'woocommerce_register_post_type_shop_coupon', array( $this, 'move_coupons' ) );