woocommerce_register_post_type_product

The WooCommerce woocommerce register post type product hook.

Description

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

Parameters (1)

0. $var — Optional. (callback) => array( 'labels' => array( 'name' => __( 'Products', 'woocommerce' ), 'singular_name' => __( 'Product', 'woocommerce' ), 'menu_name' => _x( 'Products', 'Admin menu name', 'woocommerce' ), 'add_new' => __( 'Add product', 'woocommerce' ), 'add_new_item' => __( 'Add new product', 'woocommerce' ), 'edit' => __( 'Edit', 'woocommerce' ), 'edit_item' => __( 'Edit product', 'woocommerce' ), 'new_item' => __( 'New product', 'woocommerce' ), 'view' => __( 'View product', 'woocommerce' ), 'view_item' => __( 'View product', 'woocommerce' ), 'search_items' => __( 'Search products', 'woocommerce' ), 'not_found' => __( 'No products found', 'woocommerce' ), 'not_found_in_trash' => __( 'No products found in trash', 'woocommerce' ), 'parent' => __( 'Parent product', 'woocommerce' ), 'featured_image' => __( 'Product image', 'woocommerce' ), 'set_featured_image' => __( 'Set product image', 'woocommerce' ), 'remove_featured_image' => __( 'Remove product image', 'woocommerce' ), 'use_featured_image' => __( 'Use as product image', 'woocommerce' ), 'insert_into_item' => __( 'Insert into product', 'woocommerce' ), 'uploaded_to_this_item' => __( 'Uploaded to this product', 'woocommerce' ), 'filter_items_list' => __( 'Filter products', 'woocommerce' ), 'items_list_navigation' => __( 'Products navigation', 'woocommerce' ), 'items_list' => __( 'Products list', 'woocommerce' ), ), 'description' => __( 'This is where you can add new products to your store.', 'woocommerce' ), 'public' => true, 'show_ui' => true, 'capability_type' => 'product', 'map_meta_cap' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, 'hierarchical' => false, 'rewrite' => $permalinks['product_rewrite_slug'] ? array( 'slug' => $permalinks['product_rewrite_slug'], 'with_front' => false, 'feeds' => true ) : false, 'query_var' => true, 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'comments', 'custom-fields', 'publicize', 'wpcom-markdown' ), 'has_archive' => ( $shop_page_id = wc_get_page_id( 'shop' ) ) && get_post( $shop_page_id ) ? get_page_uri( $shop_page_id ) : 'shop', 'show_in_nav_menus' => true, 'show_in_rest' => true, )
The array.

Usage

To run the hook, copy the example below.
  1. $var = apply_filters( 'woocommerce_register_post_type_product', $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_product callback 
  2. function filter_woocommerce_register_post_type_product( $var ) { 
  3. // make filter magic happen here... 
  4. return $var
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_register_post_type_product', 'filter_woocommerce_register_post_type_product', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_register_post_type_product', 'filter_woocommerce_register_post_type_product', 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_product',