Common/Context/ContextProvider.php
protected function finalize(ContextInterface $context): ContextInterface
    {
        if (null === $context->getCustomerGroup()) {
            $context->setCustomerGroup($this->customerGroupRepository->findDefault());
        }
        if (null === $context->getInvoiceCountry()) {
            $context->setInvoiceCountry($this->countryProvider->getCountry());
        }
        if (null === $context->getDeliveryCountry()) {
            $context->setDeliveryCountry($this->countryProvider->getCountry());
        }
        if (null === $context->getCurrency()) {
            $context->setCurrency($this->currencyProvider->getCurrency());
        }
        if (null === $context->getLocale()) {
            $context->setLocale($this->localProvider->getCurrentLocale());
        }
        if (null === $context->getVatDisplayMode()) {
            if (null !== $mode = $context->getCustomerGroup()->getVatDisplayMode()) {
                $context->setVatDisplayMode($mode);
            } else {
                $context->setVatDisplayMode($this->defaultVatDisplayMode);
            }
        }

        $this->eventDispatcher->dispatch(ContextEvents::BUILD, new ContextEvent($context));

        return $context;
    }
protected function finalize(ContextInterface $context): ContextInterface
    {
        if (null === $context->getCustomerGroup()) {
            $context->setCustomerGroup($this->customerGroupRepository->findDefault());
        }
        if (null === $context->getInvoiceCountry()) {
            $context->setInvoiceCountry($this->countryProvider->getCountry());
        }
        if (null === $context->getDeliveryCountry()) {
            $context->setDeliveryCountry($this->countryProvider->getCountry());
        }
        if (null === $context->getCurrency()) {
            $context->setCurrency($this->currencyProvider->getCurrency());
        }
        if (null === $context->getLocale()) {
            $context->setLocale($this->localProvider->getCurrentLocale());
        }
        if (null === $context->getVatDisplayMode()) {
            if (null !== $mode = $context->getCustomerGroup()->getVatDisplayMode()) {
                $context->setVatDisplayMode($mode);
            } else {
                $context->setVatDisplayMode($this->defaultVatDisplayMode);
            }
        }

        $this->eventDispatcher->dispatch(ContextEvents::BUILD, new ContextEvent($context));

        return $context;
    }
Fills the context's empty properties with default values.

@param ContextInterface $context

@return ContextInterface