WC_Product_Importer::normalize_global_unique_id │ protected │ WC 11.2.0

Reduce a Global Unique ID to the form it is stored in.

Keep this in step with the stripping in WC_Product::set_global_unique_id(), so a row is matched and judged usable on the same value the product would be saved with.

Method of the class: WC_Product_Importer{}

No Hooks.

Returns

string. Stored form of the Global Unique ID, or an empty string when nothing is left of it.

Usage

// protected - for code of main (parent) or child class
$result = $this->normalize_global_unique_id( $global_unique_id );
$global_unique_id(string) (required)
Global Unique ID as entered in the row.

Changelog

Since 11.2.0 Introduced.

WC_Product_Importer::normalize_global_unique_id() code WC 11.3.0

protected function normalize_global_unique_id( $global_unique_id ) {
	return (string) preg_replace( '/[^0-9Xx\-]/', '', (string) $global_unique_id );
}