public function updateCustomerGroupAndCurrency()
    {
        if (!$this->hasCart() || $this->cart->isLocked()) {
            return $this;
        }

        // Customer group
        if (null !== $customer = $this->cart->getCustomer()) {
            if ($this->cart->getCustomerGroup() !== $customer->getCustomerGroup()) {
                $this->cart->setCustomerGroup($customer->getCustomerGroup());
            }
        }

        // Sets the default customer group
        if (null === $this->cart->getCustomerGroup()) {
            $this->cart->setCustomerGroup($this->customerProvider->getCustomerGroup());
        }

        // Sets the currency
        if (null === $this->cart->getCurrency()) {
            $this->cart->setCurrency($this->currencyProvider->getCurrency());
        }

        return $this;
    }