Just use array_replace_recursive in apply_changes

This commit is contained in:
Claudiu Lodromanean 2017-03-09 09:06:05 -08:00
parent b645fc5513
commit 8a18702c27
1 changed files with 1 additions and 8 deletions

View File

@ -550,14 +550,7 @@ abstract class WC_Data {
* @since 2.7.0
*/
public function apply_changes() {
foreach ( $this->changes as $key => $change ) {
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->data = array_replace_recursive( $this->data, $this->changes );
$this->changes = array();
}