WC_Data::__clone()
When the object is cloned, make sure meta is duplicated correctly.
Description Description
Source Source
File: includes/abstracts/abstract-wc-data.php
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;
}
}
}
}
Changelog Changelog
| Version | Description |
|---|---|
| 3.0.2 | Introduced. |