You are here

protected function CanadianSalesTax::matchesRegistrations in Commerce Core 8.2

Checks whether the tax type matches the store's tax registrations.

Countries have a yearly transaction threshold (such as $30k) which when breached requires companies to register for tax collection. This also often applies to foreign companies selling to that country's residents. Furthermore, many countries are now trying to make foreign companies collect their tax when selling digital products to their residents, regardless of any threshold. The $store->tax_registrations field allows merchants to precisely specify for which countries they are collecting tax.

Parameters

\Drupal\commerce_store\Entity\StoreInterface $store: The store.

Return value

bool TRUE if the tax type matches the tax registrations, FALSE otherwise.

Overrides LocalTaxTypeBase::matchesRegistrations

File

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

Class

CanadianSalesTax
Provides the Canadian sales tax type.

Namespace

Drupal\commerce_tax\Plugin\Commerce\TaxType

Code

protected function matchesRegistrations(StoreInterface $store) {
  $store_registrations = $store
    ->get('tax_registrations')
    ->getValue();
  $store_registrations = array_column($store_registrations, 'value');
  return in_array('CA', $store_registrations);
}