WC_Post_Data::clear_global_unique_id_if_necessary()private staticWC 1.0

Clear global unique id if it's not unique.

Method of the class: WC_Post_Data{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = WC_Post_Data::clear_global_unique_id_if_necessary( $id );
$id(mixed) (required)
Post ID.

WC_Post_Data::clear_global_unique_id_if_necessary() code WC 9.3.1

private static function clear_global_unique_id_if_necessary( $id ) {
	$product = wc_get_product( $id );
	if ( $product && ! wc_product_has_global_unique_id( $id, $product->get_global_unique_id() ) ) {
		$product->set_global_unique_id( '' );
		$product->save();
	}
}