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:
parent
83de162adb
commit
82c282e83a
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue