Just use array_replace_recursive in apply_changes
This commit is contained in:
parent
b645fc5513
commit
8a18702c27
|
@ -550,14 +550,7 @@ abstract class WC_Data {
|
||||||
* @since 2.7.0
|
* @since 2.7.0
|
||||||
*/
|
*/
|
||||||
public function apply_changes() {
|
public function apply_changes() {
|
||||||
foreach ( $this->changes as $key => $change ) {
|
$this->data = array_replace_recursive( $this->data, $this->changes );
|
||||||
if ( is_array( $change ) ) {
|
|
||||||
$this->data[ $key ] = array_key_exists( $key, $this->data ) ? array_merge( $this->data[ $key ], $change ) : $change;
|
|
||||||
} else {
|
|
||||||
$this->data[ $key ] = $change;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->changes = array();
|
$this->changes = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue