WC_Data::__clone()
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() WC Data:: clone code WC 9.7.1
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; } } } }