diff --git a/includes/class-wc-cart.php b/includes/class-wc-cart.php index a5d1b762721..b99d90ffa9e 100644 --- a/includes/class-wc-cart.php +++ b/includes/class-wc-cart.php @@ -122,6 +122,15 @@ class WC_Cart extends WC_Legacy_Cart { add_action( 'woocommerce_after_checkout_validation', array( $this, 'check_customer_coupons' ), 1 ); } + /** + * When cloning, ensure object properties are handled. + */ + public function __clone() { + // These properties store a reference to the cart, so just use new instead of clone. + $this->session = new WC_Cart_Session( $this ); + $this->fees_api = new WC_Cart_Fees( $this ); + } + /* |-------------------------------------------------------------------------- | Getters.