Clone the child objects rather than instantiating new objects.

When cloning the cart, the current fees and session objects should
remain the same but have new pointers.
This commit is contained in:
James Allan 2017-12-05 16:21:02 +10:00
parent 83de162adb
commit 82c282e83a
1 changed files with 2 additions and 2 deletions

View File

@ -127,8 +127,8 @@ class WC_Cart extends WC_Legacy_Cart {
* These properties store a reference to the cart, so we use new instead of clone.
*/
public function __clone() {
$this->session = new WC_Cart_Session( $this );
$this->fees_api = new WC_Cart_Fees( $this );
$this->session = clone $this->session;
$this->fees_api = clone $this->fees_api;
}
/*