wc_product_pre_has_global_unique_id filter-hookWC 9.1.0

Gives plugins an opportunity to verify Unique ID uniqueness themselves.

Usage

add_filter( 'wc_product_pre_has_global_unique_id', 'wp_kama_wc_product_pre_has_global_unique_id_filter', 10, 3 );

/**
 * Function for `wc_product_pre_has_global_unique_id` filter-hook.
 * 
 * @param bool|null $has_global_unique_id Set to a boolean value to short-circuit the default Unique ID check.
 * @param int       $product_id           The ID of the current product.
 * @param string    $sku                  The Unique ID to check for uniqueness.
 *
 * @return bool|null
 */
function wp_kama_wc_product_pre_has_global_unique_id_filter( $has_global_unique_id, $product_id, $sku ){

	// filter...
	return $has_global_unique_id;
}
$has_global_unique_id(true|false|null)
Set to a boolean value to short-circuit the default Unique ID check.
$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()
wc_product_pre_has_global_unique_id
woocommerce/includes/wc-product-functions.php 660
$has_global_unique_id = apply_filters( 'wc_product_pre_has_global_unique_id', null, $product_id, $global_unique_id );

Where the hook is used in WooCommerce

Usage not found.