code: public function clearCart()
      {
          if (!$this->hasCart() || $this->cart->isLocked()) {
              return $this;
          }
  
          if (null !== $this->cart->getId()) {
              $this->cartOperator->delete($this->cart, true);
          }
  
          $this->cart = null;
  
          return $this;
      }
docs: {@inheritdoc}