code: public function createCart()
      {
          if ($this->hasCart()) {
              return $this->cart;
          }
  
          $this->clearCart();
  
          $this->setCart($this->cartRepository->createNew());
  
          // Sets the customer if available
          if ($this->customerProvider->hasCustomer()) {
              $this->cart->setCustomer($this->customerProvider->getCustomer());
          }
  
          $this->updateCustomerGroupAndCurrency();
  
          $this->cartOperator->initialize($this->cart);
  
          return $this->cart;
      }
docs: {@inheritdoc}