userContext = $userContext; $this->cartManagement = $cartManagement; } /** * {@inheritDoc} */ public function getOverriddenValue() { try { if ($this->userContext->getUserType() === UserContextInterface::USER_TYPE_CUSTOMER) { $customerId = $this->userContext->getUserId(); /** @var \Magento\Quote\Api\Data\CartInterface */ $cart = $this->cartManagement->getCartForCustomer($customerId); if ($cart) { return $cart->getId(); } } } catch (NoSuchEntityException $e) { /* do nothing and just return null */ } return null; } }