public function LocalTaxTypeBase::getMatchingZones in Commerce Core 8.2
Gets the tax zones which match the given address.
Parameters
\CommerceGuys\Addressing\AddressInterface $address: The address.
Return value
\Drupal\commerce_tax\TaxZone[] The tax zones, keyed by ID.
Overrides LocalTaxTypeInterface::getMatchingZones
3 calls to LocalTaxTypeBase::getMatchingZones()
- EuropeanUnionVat::resolveZones in modules/
tax/ src/ Plugin/ Commerce/ TaxType/ EuropeanUnionVat.php - Resolves the tax zones for the given order item and customer profile.
- LocalTaxTypeBase::matchesAddress in modules/
tax/ src/ Plugin/ Commerce/ TaxType/ LocalTaxTypeBase.php - Checks whether the tax type matches the store's billing address.
- LocalTaxTypeBase::resolveZones in modules/
tax/ src/ Plugin/ Commerce/ TaxType/ LocalTaxTypeBase.php - Resolves the tax zones for the given order item and customer profile.
File
- modules/
tax/ src/ Plugin/ Commerce/ TaxType/ LocalTaxTypeBase.php, line 350
Class
- LocalTaxTypeBase
- Provides the base class for local tax types.
Namespace
Drupal\commerce_tax\Plugin\Commerce\TaxTypeCode
public function getMatchingZones(AddressInterface $address) {
$address_hash = spl_object_hash($address);
if (!isset($this->matchedZones[$address_hash])) {
$this->matchedZones[$address_hash] = [];
foreach ($this
->getZones() as $zone) {
if ($zone
->match($address)) {
$this->matchedZones[$address_hash][] = $zone;
}
}
}
return $this->matchedZones[$address_hash];
}