You are here

protected function CanadianSalesTax::resolveZones in Commerce Core 8.2

Resolves the tax zones for the given order item and customer profile.

Parameters

\Drupal\commerce_order\Entity\OrderItemInterface $order_item: The order item.

\Drupal\profile\Entity\ProfileInterface $customer_profile: The customer profile. Contains the address and tax number.

Return value

\Drupal\commerce_tax\TaxZone[] The tax zones.

Overrides LocalTaxTypeBase::resolveZones

File

modules/tax/src/Plugin/Commerce/TaxType/CanadianSalesTax.php, line 50

Class

CanadianSalesTax
Provides the Canadian sales tax type.

Namespace

Drupal\commerce_tax\Plugin\Commerce\TaxType

Code

protected function resolveZones(OrderItemInterface $order_item, ProfileInterface $customer_profile) {
  $customer_address = $customer_profile
    ->get('address')
    ->first();
  if ($customer_address
    ->getCountryCode() != 'CA') {
    return [];
  }
  return parent::resolveZones($order_item, $customer_profile);
}