WC_Data::__clone()publicWC 3.0.2

When the object is cloned, make sure meta is duplicated correctly.

Method of the class: WC_Data{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Data = new WC_Data();
$WC_Data->__clone();

Changelog

Since 3.0.2 Introduced.

WC_Data::__clone() code WC 8.7.0

public function __clone() {
	$this->maybe_read_meta_data();
	if ( ! empty( $this->meta_data ) ) {
		foreach ( $this->meta_data as $array_key => $meta ) {
			$this->meta_data[ $array_key ] = clone $meta;
			if ( ! empty( $meta->id ) ) {
				$this->meta_data[ $array_key ]->id = null;
			}
		}
	}
}