$currency =
$context->
getCurrency();
$currencyTaxFreeAmount =
$currency->
getTaxFreeFrom();
$isReachedCurrencyTaxFreeAmount =
$currencyTaxFreeAmount > 0 &&
$cartNetAmount >=
$currencyTaxFreeAmount;
if ($isReachedCurrencyTaxFreeAmount) { return CartPrice::TAX_STATE_FREE;
} $country =
$context->
getShippingLocation()->
getCountry();
$isReachedCustomerTaxFreeAmount =
$country->
getCustomerTax()->
getEnabled() &&
$this->
isReachedCountryTaxFreeAmount($context,
$country,
$cartNetAmount);
$isReachedCompanyTaxFreeAmount =
$this->taxDetector->
isCompanyTaxFree($context,
$country) &&
$this->
isReachedCountryTaxFreeAmount($context,
$country,
$cartNetAmount, CountryDefinition::TYPE_COMPANY_TAX_FREE
);
if ($isReachedCustomerTaxFreeAmount ||
$isReachedCompanyTaxFreeAmount) { return CartPrice::TAX_STATE_FREE;
} if ($this->taxDetector->
useGross($context)) { return CartPrice::TAX_STATE_GROSS;
} return CartPrice::TAX_STATE_NET;
}