WordPress at a glance
function is not described

wc_product_has_unique_sku() WC 2.2

Check if product sku is unique.

Hooks from the function
Return

true/false.

Usage

wc_product_has_unique_sku( $product_id, $sku );
$product_id(int) (required)
Product ID.
$sku(string) (required)
Product SKU.

Changelog

Since 2.2 Introduced.

Code of wc_product_has_unique_sku() WC 5.0.0

<?php
function wc_product_has_unique_sku( $product_id, $sku ) {
	$data_store = WC_Data_Store::load( 'product' );
	$sku_found  = $data_store->is_existing_sku( $product_id, $sku );

	if ( apply_filters( 'wc_product_has_unique_sku', $sku_found, $product_id, $sku ) ) {
		return false;
	}

	return true;
}