/** * Set the cart to store in the current session. * * @param Cart|null The cart to store in session * * @return $this */ public function setSessionCart(Cart $cart = null) { if (null === $cart || $cart->isNew()) { self::$transientCart = $cart; $this->remove("thelia.cart_id"); } else { self::$transientCart = null; $this->set("thelia.cart_id", $cart->getId()); } return $this; }