vendor/shopware/core/Checkout/Cart/Tax/TaxDetector.php line 8

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Checkout\Cart\Tax;
  3. use Shopware\Core\Checkout\Cart\Price\Struct\CartPrice;
  4. use Shopware\Core\System\SalesChannel\SalesChannelContext;
  5. class TaxDetector
  6. {
  7.     public function useGross(SalesChannelContext $context): bool
  8.     {
  9.         return $context->getCurrentCustomerGroup()->getDisplayGross();
  10.     }
  11.     public function isNetDelivery(SalesChannelContext $context): bool
  12.     {
  13.         return $context->getShippingLocation()->getCountry()->getTaxFree();
  14.     }
  15.     public function getTaxState(SalesChannelContext $context): string
  16.     {
  17.         if ($this->isNetDelivery($context)) {
  18.             return CartPrice::TAX_STATE_FREE;
  19.         }
  20.         if ($this->useGross($context)) {
  21.             return CartPrice::TAX_STATE_GROSS;
  22.         }
  23.         return CartPrice::TAX_STATE_NET;
  24.     }
  25. }