Use array_replace in order item apply_changes

This commit is contained in:
claudiulodro 2017-08-11 13:24:43 -07:00
parent a9ecb7a2cc
commit 837e7e1ed2
1 changed files with 13 additions and 0 deletions

View File

@ -68,6 +68,19 @@ class WC_Order_Item extends WC_Data implements ArrayAccess {
}
}
/**
* Merge changes with data and clear.
* Overrides WC_Data::apply_changes.
* array_replace_recursive does not work well for order items because it merges taxes instead
* of replacing them.
*
* @since 3.2.0
*/
public function apply_changes() {
$this->data = array_replace( $this->data, $this->changes );
$this->changes = array();
}
/*
|--------------------------------------------------------------------------
| Getters