woocommerce_register_post_type_shop_coupon

The WooCommerce woocommerce register post type shop coupon hook.

Description

apply_filters( 'woocommerce_register_post_type_shop_coupon', (callback) $var ); 

Parameters (1)

0. $var — Optional. (callback) => 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' => __( 'View coupons', '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( 'manage_woocommerce' ) ? 'woocommerce' : true, 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'supports' => array( 'title' ), 'show_in_nav_menus' => false, 'show_in_admin_bar' => true, )
The array.

Usage

To run the hook, copy the example below.
  1. $var = apply_filters( 'woocommerce_register_post_type_shop_coupon', $var ); 
  2.  
  3. if ( !empty( $var ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_register_post_type_shop_coupon callback 
  2. function filter_woocommerce_register_post_type_shop_coupon( $var ) { 
  3. // make filter magic happen here... 
  4. return $var
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_register_post_type_shop_coupon', 'filter_woocommerce_register_post_type_shop_coupon', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_register_post_type_shop_coupon', 'filter_woocommerce_register_post_type_shop_coupon', 10, 1 ); 

Defined (1)

The filter is defined in the following location(s).

/includes/class-wc-post-types.php  
  1. apply_filters( 'woocommerce_register_post_type_shop_coupon',