wc_product_has_unique_sku

The WooCommerce wc product has unique sku hook.

Description

apply_filters( 'wc_product_has_unique_sku', (unknown) $sku_found, (unknown) $product_id, (unknown) $sku ); 

Parameters (3)

0. $sku_found (unknown)
The sku found.
1. $product_id (unknown)
The product id.
2. $sku (unknown)
The sku.

Usage

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

Defined (1)

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

/includes/wc-product-functions.php  
  1. if ( apply_filters( 'wc_product_has_unique_sku', $sku_found, $product_id, $sku ) ) {