wc_product_has_global_unique_id
Gives plugins an opportunity to verify Unique ID uniqueness themselves.
Usage
add_filter( 'wc_product_has_global_unique_id', 'wp_kama_wc_product_has_global_unique_id_filter', 10, 3 );
/**
* Function for `wc_product_has_global_unique_id` filter-hook.
*
* @param boolean $global_unique_id_found Whether the Unique ID is found.
* @param int $product_id The ID of the current product.
* @param string $sku The Unique ID to check for uniqueness.
*
* @return boolean
*/
function wp_kama_wc_product_has_global_unique_id_filter( $global_unique_id_found, $product_id, $sku ){
// filter...
return $global_unique_id_found;
}
- $global_unique_id_found(true|false)
- Whether the Unique ID is found.
- $product_id(int)
- The ID of the current product.
- $sku(string)
- The Unique ID to check for uniqueness.
Changelog
| Since 9.1.0 | Introduced. |
Where the hook is called
wc_product_has_global_unique_id
woocommerce/includes/wc-product-functions.php 780
if ( apply_filters( 'wc_product_has_global_unique_id', $global_unique_id_found, $product_id, $global_unique_id ) ) {